トレンド・アラート・インディケーターに基づくストップ・ロスの戦略をフォローする傾向

作者: リン・ハーンチャオチャン開催日:2024年2月5日16時35分
タグ:

img

概要

トレンドフォローストップロスの戦略は,トレンドアラート指標に基づくトレンド追跡ストップロスの取引戦略である.トレンドトラッキングエントリーを実装するためにトレンドアラート指標を通じてトレンド方向を決定する.同時に,リスク管理のためにストップロスを設定するためにATR指標を使用する.

戦略の論理

戦略は以下の主要な部分で構成されています.

  1. トレンドアラート指標は,トレンド方向を判断します. トレンドアラートが0を超えると,それは上昇信号です. 0未満の場合,それは下落信号です.

  2. ATRインジケーターは,最近の価格変動範囲を計算します. ATRをATRストップ損失倍数 atrStopMultiplierで掛け合わせると,固定ストップ損失として使用されます.

  3. 最低最低最低最低 最低と最高最高HighがATRストップ損失と共に追跡ストップ損失を構成します.構造パラメータが有効かどうかを制御します.

  4. トレンド信号の方向に応じてロングまたはショートポジションを入力します.入力した後,取利益とストップロスを設定します.

  5. 価格が損失を止めたり 利益を得たりするときに ポジションを閉じる.

この戦略は,トレンド判断によって誤った信号をフィルターし,ストップロスを追跡することでリスクを制御し,利益を得ることで収益性を確保し,取引システムの安定性を向上させます.

利点分析

この戦略の主な利点は以下の通りです.

  1. トレンドフィルタリングとストップロスの追跡の二重保証は,市場の騒音を追いかけるのを避け,制御可能な取引リスクを保証します.

  2. ATR 適応型ストップ損失設定は過剰な最適化を防止し,さまざまな市場環境に適しています.

  3. 利益を得ることで 利益が確保され 利益が消費されるのを防ぎます

  4. 戦略の論理は明確で簡潔で,理解し,変更しやすいもので,定量的なトレーダーのための二次開発に適しています.

  5. パインスクリプト言語で書かれていて,プログラミングスキルなしで TradingView プラットフォームで直接使用できます.

リスク分析

この戦略にはいくつかのリスクもあります:

  1. 誤ったトレンド判断は,不要なエントリーとストップ・ロスのトリガーを引き起こす可能性があります. 適切なストップ・ロスの緩和またはフィルターエントリー信号をすることができます.

  2. 市場が激しく波動するとき,ATRは真の幅を過小評価する可能性があります.この時点で,ATRストップ損失倍数 atrStopMultiplierは増加することができます.

  3. 目標の利益は,戦略の利益範囲を制限する可能性があります.市場に応じてlimitMultiplierパラメータを調整します.

  4. 価格のみをベースにした存在論理は 時間管理と組み合わせられるべきです

オプティマイゼーションの方向性

戦略は以下の側面で最適化できます.

  1. ATR 長さ atrLength とストップ損失倍数 atrStopMultiplier のパラメータを最適化して,ストップ損失アルゴリズムの感度を調整する.

  2. より良いエントリー機会を見つけるために 異なるトレンド指標を試してください

  3. 特定の取引品種の特徴に応じて,目標の収益パラメータを選択または調整する.

  4. タイムストップ・ロスのメカニズムを増やして 一夜間のリスクを回避する.

  5. 戦略の安定性を高めるため,取引量指標を組み合わせて偽のブレイクをフィルタリングする.

結論

一般的には,これは非常に実践的なトレンド追跡ストップ損失戦略である.トレンド追跡を達成するためにトレンド方向を決定するために指標を使用し,リスク制御を確保するために適応性停止を設定する.戦略論理は明確で使いやすいため,初心者が学ぶのに理想的です.同時に,それは高度な戦略開発のための良い取引戦略の枠組みを提供します.量的なトレーダー 深い研究と最適化に価値がある.


/*backtest
start: 2023-01-29 00:00:00
end: 2024-02-04 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jaque_verdatre

//@version=5
strategy("TrendAlert Based", overlay = true)

// Get inputs
TrendAlert = input.source(close, "TrendAlert")
atrLength = input.int(title="ATR Length", defval=15, minval=1)
useStructure = input.bool(title="Use Structure?", defval=true)
lookback = input.int(title="How Far To Look Back For High/Lows", defval=8, minval=1)
atrStopMultiplier = input.float(title="ATR Multiplier", defval=0.2, minval=0.1)
LimitMultiplier = input.float(title = "Limit Multiplier", defval = 0.5, minval = 0.1)
PineConnectorID = input.int(title = "Pine Connector ID",defval = 0)
CurrencyToSend = input.string(title = "personilized currency", defval = "ETHUSD")
Risk = input.int(title = "risk in % to send", defval = 10, minval = 1)

// Calculate data
atr = ta.atr(atrLength)
lowestLow = ta.lowest(low, lookback)
highestHigh = ta.highest(high, lookback)
longStop = (useStructure ? lowestLow : close) - atr * atrStopMultiplier
shortStop = (useStructure ? highestHigh : close) + atr * atrStopMultiplier

// Draw data to chart
plot(atr, color=color.rgb(33, 149, 243), title="ATR", display = display.none)
plot(longStop, color=color.green, title="Long Trailing Stop")
plot(shortStop, color=color.red, title="Short Trailing Stop")

var float LimitL = na
var float LimitS = na
var float LPosPrice = na
var float SPosPrice = na
var float LPosLongStop = na
var float SPosShortStop = na

KnowLimit (PosPrice, PosStop) =>
    (PosPrice-PosStop)*LimitMultiplier+PosPrice


NotInTrade = strategy.position_size == 0
InLongTrade = strategy.position_size > 0
InShortTrade = strategy.position_size < 0

longCondition = TrendAlert > 0 and NotInTrade
if (longCondition)
    LPosPrice := close
    LPosLongStop := longStop
    LimitL := KnowLimit(LPosPrice, LPosLongStop)
    strategy.entry("long", strategy.long)
    LTPPip = LimitL-LPosPrice
    LSLPip = LPosPrice-longStop
    alert(str.tostring(PineConnectorID)+',buy,'+str.tostring(CurrencyToSend)+',risk='+str.tostring(Risk)+',sl='+str.tostring(LSLPip)+'tp='+str.tostring(LTPPip), alert.freq_once_per_bar_close)
    strategy.exit("exit", "long", stop = longStop, limit = LimitL)

shortCondition = TrendAlert < 0 and NotInTrade
if (shortCondition)
    SPosPrice := close
    SPosShortStop := shortStop
    LimitS := KnowLimit(SPosPrice, SPosShortStop)
    strategy.entry("short", strategy.short)
    STPPip = SPosPrice-LimitS
    SSLPip = shortStop - SPosPrice
    alert(str.tostring(PineConnectorID)+',sell,ETHUSD,risk=10,sl='+str.tostring(SSLPip)+'tp='+str.tostring(STPPip), alert.freq_once_per_bar_close)
    strategy.exit("exit", "short", stop = shortStop, limit = LimitS)

plotshape(longCondition, color = color.green, style = shape.labelup, location = location.belowbar, size = size.normal, title = "Long Condition")
plotshape(shortCondition, color = color.red, style = shape.labeldown, location = location.abovebar, size = size.normal, title = "Short Condition")

if (InShortTrade)
    LimitL := close
    LPosLongStop := close
    LPosPrice := close

PlotLongTakeProfit = plot(LimitL, color = InLongTrade ? color.rgb(0, 255, 64) : color.rgb(120, 123, 134, 100), title = "Long Take Profit")
PlotLongStopLoss = plot(LPosLongStop, color = InLongTrade ? color.rgb(255, 0, 0) : color.rgb(120, 123, 134, 100), title = "Long Stop Loss")
PlotLongPosPrice = plot(LPosPrice, color = InLongTrade ? color.gray : color.rgb(120, 123, 134, 100), title = "Long Position Price")

if (InLongTrade)
    LimitS := close
    SPosShortStop := close
    SPosPrice := close

PlotShortTakeProfit = plot(LimitS, color = InShortTrade ? color.rgb(0, 255, 64) : color.rgb(120, 123, 134, 100), title = "Short Take Profit")
PlotShortStopLoss = plot(SPosShortStop, color = InShortTrade ? color.rgb(255, 0, 0) : color.rgb(120, 123, 134, 100), title = "Short Stop Loss")
PlotShortPosPrice = plot(SPosPrice, color = InShortTrade ? color.gray : color.rgb(120, 123, 134, 100), title = "Short Position Price")

fill(PlotLongPosPrice, PlotLongTakeProfit, color = InLongTrade ? color.rgb(0, 255, 0, 95) : color.rgb(0, 255, 0, 100))
fill(PlotShortPosPrice, PlotShortTakeProfit, color = InShortTrade ? color.rgb(0, 255, 0, 95) : color.rgb(0, 255, 0, 100))

fill(PlotLongPosPrice, PlotLongStopLoss, color = InLongTrade ? color.rgb(255, 0, 0, 95) : color.rgb(255, 0, 0, 100))
fill(PlotShortPosPrice, PlotShortStopLoss, color = InShortTrade ? color.rgb(255, 0, 0, 95) : color.rgb(255, 0, 0, 100))

もっと