価格ブレイクと平均逆転に基づくモメンタムブレイク取引戦略

作者: リン・ハーンチャオチャン開催日:2023年11月13日16時50分45秒
タグ:

img

概要

この戦略は,価格ブレイクと平均逆転を組み合わせてトレンドを決定し追跡する. 確認とフィルタリングのために複数の指標を使用する. 戦略は,厳格なエントリーと出口メカニズムを通じて小さな利益をロックすることによって,短期および中期取引に適している.

戦略の論理

  1. HMA をベースラインとして使用して価格傾向の方向性を決定します.HMA 以上の価格は上昇傾向を示し,HMA 以下の価格は下落傾向を示します.

  2. SSLチャネルは,チャネル方向との価格関係に基づいてトレンドを確認することによって確認指標として機能します.

  3. TDFIは強さを測るモメントインジケーターとして用いられる.モメントが一定のレベルに達したときにのみ取引が許される.

  4. RVI インディケーターは出口インディケーターとして機能します.RVI ラインの形が変化するとトレンドが枯渇します.

  5. ATRはストップ・ロスを計算し 利益を取ります

  6. 入場条件: 価格がベースラインを突破し,SSLチャネル方向が価格と一致し,TDFIが値に達します.

  7. 出口条件:RVIラインの形の変化,価格がベースラインとSSLチャネルを通って戻る.

利点分析

  1. 複数の指標を組み合わせることで 誤ったブレイクを効果的にフィルタリングできます

  2. 厳格な入口条件と ストップ損失 退出制御 シングル損失

  3. 価格の動向を最大限に活用して 過剰な利益を得ます

  4. 異なる製品と時間枠に適応できる指標パラメータのための大きな最適化空間

リスク分析

  1. トレンド逆転を特定できず,高値/低値を追いかけて過剰取引の危険性がある.

  2. 短期取引,過剰取引のリスク

  3. ストップ・ロスのレベル設定に主観的な影響は,緩すぎたり,狭すぎたりする可能性があります.

  4. パラメータの設定が正しくない場合,取引が頻繁すぎたり不足したりする可能性があります.

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

  1. トレンド判断指標を追加して,トレンド方向の決定の正確性を確保する.

  2. 高値/低値を追いかける確率を減らすため,逆転信号インジケーターを組み込む.

  3. ATRをATR トレイリングストップに動的に調整することで,より動的なストップ損失を得ることができます.

  4. パラメータ最適化方向を見つけるために異なるMAシステムをテストする.

  5. 特定の取引製品のためのパラメータを最適化する.

結論

この戦略は,マルチインジケーター確認を通じて取引信号の精度を達成する. 厳格なストップ損失メカニズムは単一の損失を制御する. 技術分析操作に慣れている人に適している. パラメータは異なる市場サイクルに調整できる. 全体的に,この戦略はポジティブな期待利益と利益を持っています. しかし,誤ったトレンド判断とオーバートレードのリスクは注意する必要があります.


/*backtest
start: 2022-11-06 00:00:00
end: 2023-11-12 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Designed per No Nonsense Forex VP rules
//Made to be as modular as possible, so we can swap the indicators in and out.
//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 within 1 candles of baseline + 1 x confirmation + volume
//// - Entry only if baseline is < 1 x ATR
// - Exit conditions
//// - Exit on exit indicator or when baseline or confirmation flip 

///////////////////////////////////////////////////
//Trades entries
///////////////////////////////////////////////////
// - First entry L1 or S1 with standard SL and TP
// - Second entry L2 or S2 with standard SL and exit upon the exit conditions

///////////////////////////////////////////////////
//Included Indicators and settings
///////////////////////////////////////////////////
// - Baseline = HMA 20
// - Confirmtion = SSL 10
// - Volume = TDFI 4
// - Exit = RVI 4

///////////////////////////////////////////////////
//Credits
// Strategy causecelebre https://www.tradingview.com/u/causecelebre/
// TDFI causecelebre https://www.tradingview.com/u/causecelebre/
// SSL Channel ErwinBeckers https://www.tradingview.com/u/ErwinBeckers/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

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

//Price
price = close

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

atrLength = input(14, "ATR Length")
slMultiplier = input(1.5, "SL")
tpMultiplier = input(1, "TP")
atr = atr(atrLength)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  **** Baseline ****
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//HMA 20
///////////////////////////////////////////////////

hmaslowlength = input(20, minval=1)
src = input(close, title="Source")
slowhullma = wma(2*wma(src, hmaslowlength/2)-wma(src, hmaslowlength), round(sqrt(hmaslowlength)))
plot(slowhullma, title = "baseline", color = yellow, linewidth=2, transp=0)

///////////////////////////////////////////////////
// Base Signals
///////////////////////////////////////////////////

///////////////////////////////////////////////////
baseline = slowhullma

//Signals based on crossover
//baseShort = crossover(baseLine, price)
//baseLong = crossover(price, baseLine)

//Signals based on signal position
b_Short = baseline > price ? 1 : 0
l_Long = baseline < price ? 1 : 0

baseShort = b_Short
baseLong = l_Long

///////////////////////////////////////////////////
//ATR Check
///////////////////////////////////////////////////

distBasefromPrice = abs(baseline - price)
atrCheck = distBasefromPrice <= atr ? 1 : 0

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

///////////////////////////////////////////////////
//SSL Channel
///////////////////////////////////////////////////

sslLen=input(title="SSL 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

///////////////////////////////////////////////////
//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)

confirmLong = c_Long
confirmShort = c_Short

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  **** Volume Indicator Start ****
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//TDFI
///////////////////////////////////////////////////

lookback = input(4, title = "TDFI Lookback") 
filterHigh = input(0.05, title = "Filter High") 
filterLow = input(-0.05, title = "Filter Low") 

mma = ema(price * 1000, lookback)
smma = ema(mma, lookback)

impetmma = mma - mma[1]
impetsmma= smma - smma[1]
divma = abs(mma - smma)
averimpet = (impetmma + impetsmma) / 2

number = averimpet
pow = 3
result = na

for i = 1 to pow - 1
    if i == 1
        result := number
    result := result * number

tdf = divma * result
ntdf = tdf / highest(abs(tdf), lookback * 3)

///////////////////////////////////////////////////
//Volume Signals
///////////////////////////////////////////////////
v_Long = ntdf > filterHigh ? 1 : 0
v_Short = filterLow > ntdf ? 1 : 0

volumeLong = v_Long
volumeShort = v_Short

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// **** Exit Indicator ****
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//RVI 4
///////////////////////////////////////////////////

rgvlen = input(4, title="RVI Length", minval=1)
rvi = sum(swma(close-open), rgvlen)/sum(swma(high-low),rgvlen)
sig = swma(rvi)

///////////////////////////////////////////////////
//Exit Signals
///////////////////////////////////////////////////
e_Short = crossover(rvi, sig)
e_Long = crossover(sig, rvi)

exitOutofShort = e_Short
exitOutofLong = e_Long

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// **************************** Logic to handle NNFX rules ****************************
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Checking for base and confirmation indication with 1 candle difference
baseandConfirmLong = ((baseLong[0] and confirmLong[0]) or (baseLong[1] and confirmLong[0]) or (baseLong[1] and confirmLong[1]) or (baseLong[0] and confirmLong[1])) ? 1 : 0
baseandConfirmShort = ((baseShort[0] and confirmShort[0]) or (baseShort[1] and confirmShort[0]) or (baseShort[1] and confirmShort[1]) or (baseShort[0] and confirmShort[1])) ? 1 : 0

//Combining with volume with 1 candle difference
enterLong = ((baseandConfirmLong[0] and volumeLong[0]) or (baseandConfirmLong[1] and volumeLong[0]) or (baseandConfirmLong[1] and volumeLong[1]) or (baseandConfirmLong[0] and volumeLong[1])) ? 1 : 0
enterShort = ((baseandConfirmShort[0] and volumeShort[0]) or (baseandConfirmShort[1] and volumeShort[0]) or (baseandConfirmShort[1] and volumeShort[1]) or (baseandConfirmShort[0] and volumeShort[1])) ? 1 : 0

//Exit on base or confirmation flip over
baseandConfirmFliptoShort = ((baseShort[0] or confirmShort[0]) or (baseShort[1] or confirmShort[0]) or (baseShort[1] or confirmShort[1]) or (baseShort[0] or confirmShort[1])) ? 1 : 0
baseandConfirmFliptoLong = ((baseLong[0] or confirmLong[0]) or (baseLong[1] or confirmLong[0]) or (baseLong[1] or confirmLong[1]) or (baseLong[0] or confirmLong[1])) ? 1 : 0

//Exit on base and confirmation flip or exit indicator 
exitLong = exitOutofLong or baseandConfirmFliptoShort ? 1 : 0 
exitShort = exitOutofShort or baseandConfirmFliptoLong ? 1 : 0 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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.entry("L1", strategy.long, when = enterLong and atrCheck)
    strategy.exit("L1 SL Exit", "L1", stop = long_sl, limit = long_tp)
    strategy.close("L1", when = exitLong)
    
    //Long entries with no TP
    strategy.entry("L2", strategy.long, when = enterLong and atrCheck)
    strategy.exit("L2 SL Exit", "L2", stop = long_sl)
    strategy.close("L2", when = exitLong)

    //Short entries with standard 1.5 ATR for SL, 1 ATR for TP
    short_sl = price + atr * slMultiplier
    short_tp = price - atr * tpMultiplier
    strategy.entry("S1", strategy.short, when = enterShort and atrCheck)
    strategy.exit("S1 SL Exit", "Short1", stop = short_sl, limit = short_tp)
    strategy.close("S1", when = exitShort)
    
    //Short entries with no TP
    strategy.entry("S2", strategy.short, when = enterShort and atrCheck)
    strategy.exit("S2 Exit", stop = short_sl)
    strategy.close("S2", when = exitShort)
    
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//End
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    




もっと