
확장 가능한 브레이크 트레이딩 전략은 가격의 핵심 지지 저항 영역을 식별하여 가격이 이러한 영역을 뚫을 때 거래 신호를 생성하는 매우 유연한 확장 가능한 브레이크 트레이딩 전략입니다. 이 전략은 파라미터를 조정하여 다른 시간 주기에 적용 할 수 있으며 다양한 추가 필터 조건과 위험 관리 장치를 쉽게 통합하여 특정 자산에 최적화 할 수 있습니다.
이 전략은swings()이 함수는 재검토 기간에 기초하여 현재 가격의 변동 고점과 변동 저점을 계산한다. 재검토 기간을 통해swingLookback파라미터를 설정하고, 20개의 K 선을 기본으로 한다. 그 후, 가격이 변동의 높은 지점을 넘으면 더 많이 하고, 가격이 변동의 낮은 지점을 넘으면 더 적게 한다.
더 많은 신호의 구체적인 논리는, 종결 가격이 높은 가격과 같을 때 더 많은 것을하는 것이다.
이 전략은 또한 Stop Loss을 설정하고,stopTargetPercent스톱로스를 설정하는 변수. 예를 들어, 최대 가격의 5% 미만으로 설정된 다중 스톱로스 가격, 최저 가격의 5% 이상으로 설정된 다중 스톱로스 가격.
이 전략의 장점은 재검토 기간을 조정하여 거래 빈도를 조절할 수 있다는 것입니다. 재검토 기간이 짧을수록, 돌파구에 더 민감하고 거래 빈도가 더 높습니다. 재검토 기간이 너무 길면 거래 빈도가 낮아지지만 기회를 놓칠 수 있습니다. 따라서 최적의 재검토 기간을 찾는 것이 전략에 최적화하는 데 중요합니다.
대책:
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
다양한 검토 기간 변수를 테스트하여 최적의 변수 조합을 찾습니다.
5분, 15분, 1시간 등의 다양한 거래 주기를 테스트하여 최적의 주기를 선택합니다.
손실을 막고, 수익을 창출하고, 위험을 통제하는 것을 최적화하십시오.
불량 신호를 줄이기 위해 거래량 필터, 점유율 필터와 같은 필터 조건을 추가합니다.
더 많은 위험 관리 장치의 통합, 예를 들어, 손실 이동, 이익 잠금;
매개 변수 최적화, 단계적 최적화, 무작위 검색 등이 최적의 매개 변수를 찾습니다.
기계 학습 기술을 통합하여 AI를 사용하여 매개 변수를 자동으로 최적화합니다.
확장 가능한 브레이크 트레이딩 전략은 매우 실용적인 브레이크 시스템이다. 그것은 간단하고 사용하기 쉽고, 사용자 정의가 강하며, 회귀 기간을 조정하고 다양한 필터 조건을 통합하여 서로 다른 자산에 최적화 할 수 있다. 동시에, 다양한 위험 관리 장치를 쉽게 통합하여 거래 위험을 제어 할 수 있다. 변수 최적화 및 기계 학습과 같은 기술의 도입으로 전략은 지속적으로 업그레이드되어 시장의 변화에 적응할 수 있다.
/*backtest
start: 2023-09-29 00:00:00
end: 2023-10-29 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © deperp
//@version=5
// strategy("Range Breaker", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.07, pyramiding=0)
// Backtest Time Period
useDateFilter = input.bool(true, title="Begin Backtest at Start Date",
group="Backtest Time Period")
backtestStartDate = input(timestamp("1 Jan 2020"),
title="Start Date", group="Backtest Time Period",
tooltip="This start date is in the time zone of the exchange " +
"where the chart's instrument trades. It doesn't use the time " +
"zone of the chart or of your computer.")
inTradeWindow = true
swingLookback = input.int(20, title="Swing Lookback", minval=3)
stopTargetPercent = input.float(5, title="Stop Target Percentage", step=0.1)
// Calculate lockback swings
swings(len) =>
var highIndex = bar_index
var lowIndex = bar_index
var swingHigh = float(na)
var swingLow = float(na)
upper = ta.highest(len)
lower = ta.lowest(len)
if high[len] > upper
highIndex := bar_index[len]
swingHigh := high[len]
if low[len] < lower
lowIndex := bar_index[len]
swingLow := low[len]
[swingHigh, swingLow, highIndex, lowIndex]
// Strategy logic
[swingHigh, swingLow, highIndex, lowIndex] = swings(swingLookback)
longCondition = inTradeWindow and (ta.crossover(close, swingHigh))
shortCondition = inTradeWindow and (ta.crossunder(close, swingLow))
if longCondition
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
longStopTarget = close * (1 + stopTargetPercent / 100)
shortStopTarget = close * (1 - stopTargetPercent / 100)
strategy.exit("Long Stop Target", "Long", limit=longStopTarget)
strategy.exit("Short Stop Target", "Short", limit=shortStopTarget)
// Plot break lines
// line.new(x1=highIndex, y1=swingHigh, x2=bar_index, y2=swingHigh, color=color.rgb(255, 82, 82, 48), width=3, xloc=xloc.bar_index, extend=extend.right)
// line.new(x1=lowIndex, y1=swingLow, x2=bar_index, y2=swingLow, color=color.rgb(76, 175, 79, 47), width=3, xloc=xloc.bar_index, extend=extend.right)
// Alert conditions for entry and exit
longEntryCondition = inTradeWindow and (ta.crossover(close, swingHigh))
shortEntryCondition = inTradeWindow and (ta.crossunder(close, swingLow))
longExitCondition = close >= longStopTarget
shortExitCondition = close <= shortStopTarget
alertcondition(longEntryCondition, title="Long Entry Alert", message="Enter Long Position")
alertcondition(shortEntryCondition, title="Short Entry Alert", message="Enter Short Position")
alertcondition(longExitCondition, title="Long Exit Alert", message="Exit Long Position")
alertcondition(shortExitCondition, title="Short Exit Alert", message="Exit Short Position")