
漸進的追跡ストップ戦略は,ストップラインを動的に調整し,リスク管理とストップ・キャプチャの有機的な組み合わせを実現する.平均実際の波動範囲を使用してストップラインを計算し,株価のトレンドを効果的に追跡し,利益を保護しながら不必要なストップを減らす.この戦略は,トレンドが強い株に適用され,安定した利益を得ることができます.
この戦略は,動的ストップの基礎として,平均実際の波動範囲 (ATR) を計算する.ATRは,株の変動性を効果的に反映する.戦略は,ATR周期パラメータを入力し,典型的には10日間である.そしてATR値を計算する.株価が上昇すると,ストップラインもそれに合わせて移動し,動的に追跡される.株価が下がると,ストップラインは変わらないので,利益をロックすることができます.同時に,戦略は,因子参数によってストップラインと株価の距離を微調整することができます.
具体的には,策略は,現在のK線のATR値を計算し,因子参数で倍し,止損距離を得ます. 株価が止損価格より高い場合は,多ポジションを開きます. 株価が止損価格より低い場合は,空ポジションを開きます. このようにして,止損線は,株価の運行に緊密に貼り付けられ,止損線の漸進追跡効果を実現します.
漸進的なトラッキングストップ戦略は,ストップ距離を動的に調整することで,リスク制御とストップ・キャプチャの有効なバランスを実現する. この戦略は,操作がシンプルで,高度にカスタマイズされ,ロボット自動取引に適しています. もちろん,合理的なパラメータ選択と指標の組み合わせは,まだ人工経験が必要です. この戦略は,さらなる最適化により,より安定した投資収益を得ることを期待しています.
/*backtest
start: 2023-10-17 00:00:00
end: 2023-10-24 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Supertrend Strategy, by Ho.J.", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=15)
// 백테스팅 시작일과 종료일 입력
startYear = input(2020, title="Start Year")
startMonth = input(1, title="Start Month")
startDay = input(1, title="Start Day")
endYear = input(9999, title="End Year")
endMonth = input(12, title="End Month")
endDay = input(31, title="End Day")
// 백테스팅 시간 범위 확인
backtestingTimeBool = (year >= startYear and month >= startMonth and dayofmonth >= startDay) and (year <= endYear and month <= endMonth and dayofmonth <= endDay)
atrPeriod = input(10, "ATR Length")
factor = input.float(3.0, "Factor", step = 0.01)
[_, direction] = ta.supertrend(factor, atrPeriod)
var bool longCondition = false
var bool shortCondition = false
if backtestingTimeBool
prevDirection = direction[1]
if direction < 0
longCondition := false
shortCondition := true
else if direction > 0
longCondition := true
shortCondition := false
if longCondition
strategy.entry("My Long Entry Id", strategy.long)
if shortCondition
strategy.entry("My Short Entry Id", strategy.short)
plot(strategy.equity, title="equity", color=color.rgb(255, 255, 255), linewidth=2, style=plot.style_area)