ノロのトレンド・ムービング・平均値戦略の極端なバージョン

作者: リン・ハーンチャオチャン開催日:2024年01月31日17時53分
タグ:

img

概要

この戦略は,トレンド方向とロング/ショートチャンスを識別するために2つの移動平均指標を使用します. ゆっくりとした移動平均線 (青い線) は全体的なトレンド方向を決定するために使用され,価格チャネルと組み合わせた高速な移動平均線 (赤線) は取引機会を発見するために使用されます.

戦略の論理

  1. 2つの移動平均を計算する.全体的な傾向を決定するために21期間のより遅いMAと,取引機会を見つけるために価格チャネルと組み合わせる5期間のより速いMA.

  2. 現在の価格が前期に形成された価格チャネルを突破しているかどうかを確認します.突破は潜在的な取引機会をシグナルします.

  3. 最近のキャンドルスタイクの数と方向を計算する.例えば,連続するいくつかの下落キャンドルスタイクが長い機会を示し,連続した上昇キャンドルスタイクが短い機会を示し得る.キャンドルスタイクの数は,Barsパラメータによって設定できます.

  4. 上記のすべての要素を組み合わせて,ロング/ショート信号を生成します.価格動きが,より遅いMAトレンド方向に準拠し,高速MAまたは価格チャネルが信号を生成し,キャンドルストークの動きが条件に一致すると信号が起動します.

利点

  1. 二重移動平均系は,効率的にトレンドの方向性を追跡します.

  2. より速いMAと価格チャネルを組み合わせることで 早期のブレイクポイントを検出し 取引機会を把握できます

  3. また,市場逆転に巻き込まれないように,キャンドルスタイルの方向とカウントも考慮します.

  4. パーソナライズ可能なMAパラメータは,異なる製品と時間枠で動作します.

リスクと緩和策

  1. ダブルMAsは横向市場では誤った信号を生成し,振動器やATRを追加して不安定な市場取引を回避することができます.

  2. 市場の動きに 巻き込まれるリスクは まだあります

  3. 完全に逆転を回避することは不可能です 戦略をより堅牢にするために 論理とパラメータを改善し続けます

増進 の 機会

  1. ADXやMACDのような サポート指標を追加して 不安定な市場での間違った取引を避けるのです

  2. 動的ストップ損失計算,例えばATRとリスク優先度に基づいて

  3. 機械学習によるパラメータ最適化

  4. 細かな調節パラメータは,例えば暗号通貨の短い期間に基づく.

結論

この戦略は,トレンド市場を追跡し,さらなるブレイクアウトの機会を備えて非常にうまく機能しています.適切な改良により,商業的に実行可能な高品質の量戦略に変えることができます.我々はより多くの市場を安定的に取引するためにそれを改善し続けます.


/*backtest
start: 2023-12-31 00:00:00
end: 2024-01-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy(title = "Noro's Trend MAs Strategy v1.9 Extreme", shorttitle = "Trend MAs str 1.9 extreme", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value=100.0, pyramiding=0)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
needstops = input(false, "stops")
stoppercent = input(5, defval = 5, minval = 1, maxval = 50, title = "Stop, %")
useohlc4 = input(false, defval = false, title = "Use OHLC4")
usefastsma = input(true, "Use fast MA Filter")
fastlen = input(5, defval = 5, minval = 1, maxval = 50, title = "fast MA Period")
slowlen = input(21, defval = 20, minval = 2, maxval = 200, title = "slow MA Period")
bars = input(2, defval = 2, minval = 0, maxval = 3, title = "Bars Q")
needbg = input(false, defval = false, title = "Need trend Background?")
needarr = input(false, defval = false, title = "Need entry arrows?")
needex = input(true, defval = true, title = "Need extreme? (crypto/fiat only!!!)")

src = useohlc4 == true ? ohlc4 : close

//PriceChannel 1
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//PriceChannel 2
lasthigh2 = highest(src, fastlen)
lastlow2 = lowest(src, fastlen)
center2 = (lasthigh2 + lastlow2) / 2

//Trend
trend = low > center and low[1] > center[1] ? 1 : high < center and high[1] < center[1] ? -1 : trend[1]

//Bars
bar = close > open ? 1 : close < open ? -1 : 0
redbars = bars == 0 ? 1 : bars == 1 and bar == -1 ? 1 : bars == 2 and bar == -1 and bar[1] == -1 ? 1 : bars == 3 and bar == -1 and bar[1] == -1 and bar[2] == -1 ? 1 : 0
greenbars = bars == 0 ? 1 : bars == 1 and bar == 1 ? 1 : bars == 2 and bar == 1 and bar[1] == 1 ? 1 : bars == 3 and bar == 1 and bar[1] == 1 and bar[2] == 1 ? 1 : 0

//Signals
up = trend == 1 and (low < center2 or usefastsma == false) and (redbars == 1) ? 1 : 0
dn = trend == -1 and (high > center2 or usefastsma == false) and (greenbars == 1) ? 1 : 0

up2 = high < center and high < center2 and bar == -1 ? 1 : 0
dn2 = low > center and low > center2 and bar == 1 ? 0 : 0

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "Slow MA")
plot(center2, color = red, linewidth = 3, transp = 0, title = "PriceChannel 2")

//Arrows
plotarrow(up == 1 and needarr == true ? 1 : 0, colorup = black, colordown = black, transp = 0)
plotarrow(dn == 1 and needarr == true ? -1 : 0, colorup = black, colordown = black, transp = 0)

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)

//Alerts
alertcondition(up == 1, title='buy', message='Uptrend')
alertcondition(dn == 1, title='sell', message='Downtrend')

//Trading
stoplong = up == 1 and needstops == true ? close - (close / 100 * stoppercent) : stoplong[1]
stopshort = dn == 1 and needstops == true ? close + (close / 100 * stoppercent) : stopshort[1]

longCondition = up == 1 or (up2 == 1 and needex == true)
if (longCondition)
    strategy.entry("Long", strategy.long, needlong == false ? 0 : na)
    strategy.exit("Stop Long", "Long", stop = stoplong)

shortCondition = dn == 1
if (shortCondition)
    strategy.entry("Short", strategy.short, needshort == false ? 0 : na)
    strategy.exit("Stop Short", "Short", stop = stopshort)

もっと