SSLチャネルインジケーターに基づくトレンドフォロー戦略


作成日: 2023-11-27 16:42:34 最終変更日: 2023-11-27 16:42:34
コピー: 0 クリック数: 1449
1
フォロー
1621
フォロワー

SSLチャネルインジケーターに基づくトレンドフォロー戦略

概要

この戦略は,SSL通道指標に基づくトレンド追跡戦略である.これは,安定した資金成長を実現するために,利益をロックするために,ストップ・ロズとストップ・ストップ・マネジメントを組み合わせている.

戦略原則

コードの主な論理は,SSL上線と下線の黄金交差を使ってトレンドの方向を判断することである。具体的には,SSL上線が下線からSSL上線を突破するとき,多行し,SSL下線が上線からSSL上線を突破するとき,空行する。

ポジションに入ると,戦略はATR指標を係数で掛けることで,ストップ・ロスとストップ・価格を設定する.例えば,ストップ・ロスの価格はATR*1.5と,ストップ・ロスの価格はATR*1と.これは単一損失を効果的に制御し,利益をロックする.

SSLチャネルがフォークしたときに平仓する.

優位分析

  1. SSLチャネルによるトレンド判断の正確さ
  2. リスク管理のための合理的な停止と停止設定
  3. タイムストップ・トレンド・ターニング・ポイント

リスク分析

  1. トレンド取引は過剰取引になりやすい
  2. SSL 経路の判断に失敗する確率は存在します
  3. ATR係数を最適化する必要があります.

解決策は次の通りです

  1. ポジションの周期を適切に調整する
  2. 他の指標と組み合わせた確認
  3. 異なるATR係数の組み合わせをテストする

最適化の方向

  1. ATRパラメータを最適化して,最適なパラメータの組み合わせを見つける
  2. フィルタリングと確認信号の追加
  3. 市場によって調整されたポジション周期
  4. ストップ・ストップ・ストップ戦略の最適化

要約する

この戦略は,全体的な考え方が明確で,SSL通路の判断傾向を使用し,合理的な止損を設定している.しかし,偽の信号をフィルターする他の指標と組み合わせて,最適なパラメータの組み合わせを見つけるために,さらなるテストと最適化が必要である.同時に,異なる市場に応じてパラメータを調整して,戦略をより弾力的にする.全体として,この戦略は,安定した収入を実現するための信頼できる枠組みを提供します.

ストラテジーソースコード
/*backtest
start: 2022-11-26 00:00:00
end: 2023-05-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Designed per No Nonsense Forex VP rules
//For testing your individual indicators before the full system
//Originated from causecelebre
//Tried to put in as much VP rules as possible

///////////////////////////////////////////////////
//Rules Implemented:
///////////////////////////////////////////////////
// - SL 1.5 x ATR
// - TP 1 x ATR
//
// - Entry conditions
//// - Entry from 1 x confirmation
// - Exit conditions
//// - Exit on confirmation flip 

///////////////////////////////////////////////////
//Trades entries
///////////////////////////////////////////////////
// - First entry L1 or S1 with standard SL and TP

///////////////////////////////////////////////////
//Included Indicators and settings
///////////////////////////////////////////////////
// - Confirmtion = SSL 10

///////////////////////////////////////////////////
//Credits
// Strategy causecelebre https://www.tradingview.com/u/causecelebre/
// SSL Channel ErwinBeckers https://www.tradingview.com/u/ErwinBeckers/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Change log
//First release. Testing of indicators
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

strategy(title="NNFX Strategy Indicator | jh", overlay = true )

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  **** Set the main stuff  ****
///////////////////////////////////////////////////

//Price
price = close

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ATR stuff
///////////////////////////////////////////////////

slMultiplier = input(1.5, "SL")
tpMultiplier = input(1, "TP")

atrlength = input(title="ATR Length", defval=14, minval=1)
atrsmoothing = input(title="Smoothing", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"])

ma_function(source, atrlength) => 
    if atrsmoothing == "RMA"
        rma(source, atrlength)
    else
        if atrsmoothing == "SMA"
            sma(source, atrlength)
        else
            if atrsmoothing == "EMA"
                ema(source, atrlength)
            else
                wma(source, atrlength)

//plot(ma_function(tr(true), atrlength), title = "ATR", color=#991515, transp=0)

atr = ma_function(tr(true), atrlength)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  **** Confirmation ****
///////////////////////////////////////////////////

ssllen=input(title="SSL Length Period", defval=10)
smaHigh=sma(high, ssllen)
smaLow=sma(low, ssllen)
Hlv = na
Hlv := close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1]
sslDown = Hlv < 0 ? smaHigh: smaLow
sslUp   = Hlv < 0 ? smaLow : smaHigh

plot(sslDown, "SSL Down", linewidth=1, color=red)
plot(sslUp, "SSL Up", linewidth=1, color=lime)

///////////////////////////////////////////////////
//Confirm Signals
///////////////////////////////////////////////////

c_Up = sslUp
c_Down = sslDown

//Signals based on crossover
c_Long = crossover(c_Up, c_Down)
c_Short = crossover(c_Down, c_Up)

//Signals based on signal position
trendLong = c_Up > c_Down ? 1 : 0
trendShort = c_Down > c_Up ? 1 : 0

confirmLong = c_Long
confirmShort = c_Short

plotshape(trendLong, color = green, style=shape.triangleup, location=location.bottom)
plotshape(trendShort, color = red, style=shape.triangledown, location=location.bottom)


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Entries and Exits
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (year>2009)

    //Long entries with standard 1.5 ATR for SL, 1 ATR for TP
    long_sl = price - (atr * slMultiplier)
    long_tp = price + (atr * tpMultiplier)
    strategy.order("L1", strategy.long, when = confirmLong)
    strategy.close("L1", when = confirmShort)
    strategy.exit("L Limit Exit", "L1", stop = long_sl, limit = long_tp)

    
    //Short entries with standard 1.5 ATR for SL, 1 ATR for TP
    short_sl = price + (atr * slMultiplier)
    short_tp = price - (atr * tpMultiplier)
    strategy.order("S1", strategy.short, when = confirmShort)
    strategy.close("S1", when = confirmLong)
    strategy.exit("S Limit Exit", "S1", stop = short_sl, limit = short_tp)


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//End
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////