
이 전략은 metrobonez1ty 전략 테스터를 기반으로 개발된 강화형 정량화 거래 전략이다. 이 전략의 주요 특징은 다단계 수익 목표 및 동적 중지 손실 메커니즘을 구현하는 동시에 외부 지표 신호와 통합하는 유연성을 유지하는 것이다. 이 전략은 최대 3 개의 수익 목표 위치를 지원하며, 지표 기반의 손실 트리거를 선택적으로 사용하여 추가 신호 확인을 통해 거래 입시를 필터링한다.
전략의 핵심 논리는 다단계 퇴출 메커니즘을 중심으로 펼쳐진다. 입시 측면에서 전략은 longEntry와 shortEntry의 두 가지 입력원을 통해 다단계 및 공허 거래 신호를 유발한다. 각 거래 방향에 대해 전략은 세 개의 독립적인 수익 목표 (TP1, TP2, TP3) 를 설정하고, 각 목표는 외부 지표 신호에 따라 동적으로 조정할 수 있다.
이 전략은 다단계 수익 목표와 동적 스톱 로즈 메커니즘을 통해 포괄적인 거래 프레임워크를 제공합니다. 전략의 장점은 유연성과 사용자 정의에 있습니다. 그러나 동시에 파라미터 최적화 및 시장 적응성에 대한 문제를 신중하게 처리해야합니다. 제안된 최적화 방향을 통해 전략은 더욱 안정성과 적응성을 향상시킬 수 있으며 더 완벽한 거래 시스템입니다.
/*backtest
start: 2025-02-04 00:00:00
end: 2025-02-18 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Enhanced Strategy Tester with multi TP and SL Trigger", overlay=true, margin_long=100, margin_short=100)
// Entry Signals
longEntry = input.source(close, 'Long Entry Trigger', 'long signal source')
shortEntry = input.source(close, 'Short Entry Trigger', 'short signal source')
// Exit Triggers
activateLongExit = input.bool(false, 'Activate Long Exit Signals')
longExit1 = input.source(high, 'Long Exit TP1')
longExit2 = input.source(high, 'Long Exit TP2')
longExit3 = input.source(high, 'Long Exit TP3')
activateShortExit = input.bool(false, 'Activate Short Exit Signals')
shortExit1 = input.source(low, 'Short Exit TP1')
shortExit2 = input.source(low, 'Short Exit TP2')
shortExit3 = input.source(low, 'Short Exit TP3')
// Stop Loss from External Indicator
useSLSignal = input.bool(false, 'Activate SL Signal')
slSignal = input.source(low, 'SL', 'SL Signal Source')
// Long Entry Condition
longCondition = not na(longEntry) and longEntry > 0
if (longCondition and strategy.opentrades == 0)
strategy.entry('long', strategy.long)
strategy.exit('exit_long_tp1', 'long', limit=longExit1, comment='TP1 hit')
strategy.exit('exit_long_tp2', 'long', limit=longExit2, comment='TP2 hit')
strategy.exit('exit_long_tp3', 'long', limit=longExit3, comment='TP3 hit')
strategy.exit('exit_long_sl', 'long', stop=useSLSignal ? slSignal : na, comment='SL hit')
// Long Exit Condition
if (activateLongExit)
if (not na(longExit1) and longExit1 > 0)
strategy.close('long', comment='TP1 at Exit')
if (not na(longExit2) and longExit2 > 0)
strategy.close('long', comment='TP2 at Exit')
if (not na(longExit3) and longExit3 > 0)
strategy.close('long', comment='TP3 at Exit')
// Short Entry Condition
shortCondition = not na(shortEntry) and shortEntry > 0
if (shortCondition and strategy.opentrades == 0)
strategy.entry('short', strategy.short)
strategy.exit('exit_short_tp1', 'short', limit=shortExit1, comment='TP1 hit')
strategy.exit('exit_short_tp2', 'short', limit=shortExit2, comment='TP2 hit')
strategy.exit('exit_short_tp3', 'short', limit=shortExit3, comment='TP3 hit')
strategy.exit('exit_short_sl', 'short', stop=useSLSignal ? slSignal : na, comment='SL hit')
// Short Exit Condition
if (activateShortExit)
if (not na(shortExit1) and shortExit1 > 0)
strategy.close('short', comment='TP1 at Exit')
if (not na(shortExit2) and shortExit2 > 0)
strategy.close('short', comment='TP2 at Exit')
if (not na(shortExit3) and shortExit3 > 0)
strategy.close('short', comment='TP3 at Exit')