
この戦略は,海指数に基づく暗号通貨のトレンド追跡戦略である.これは,2つの異なる周期の指数移動平均と海指数と組み合わせた複数の条件を使用して取引シグナルを生成する.この戦略は,中長線の価格トレンドを認識し,トレンドが転じるときに間に合うように入場することを目的としている.
この戦略は50周期と100周期のEMA平均線を使用する.同時に,海線を計算する.これは,市場騒音をフィルターする特殊な線である.この戦略は海線の開値,閉値,最高値と最低値を使用し,より正確な取引信号を発生させるために100周期のEMA線に適用する.
具体的には,100周期海線の開場価格が閉場価格より高く,上方のK線の開場価格が閉場価格より低ければ,多額のシグナルである.反対に,100周期海線の開場価格が閉場価格より低く,上方のK線の開場価格が閉場価格より高く,空のシグナルである.
この戦略は,二重EMAシステムと海指標を組み合わせて,中長線トレンドが形成される時に適切な機会を捉えることを目的としている.それは,海指標を使用して,短期市場のノイズをフィルターし,取引信号をより信頼性のあるものにします.
リスクを軽減するために,適切なストップを縮小したり,他の指標と組み合わせてトレンドの逆転を判断することを考慮したりできます.市場が震動区間に入ると,この戦略を一時的に停止して新しいトレンドの発生を待つこともできます.
この戦略は以下の方向から最適化できます.
海指数に基づく暗号通貨のトレンド追跡戦略は,トレンド判断,入場タイミング,ストップ損失制御の複数の側面を総合的に考慮し,暗号通貨のこのような高波動の品種に非常に適しています.この戦略は,海指数フィルターノイズを使用し,堅牢なリスク管理方法を採用し,中長線価格トレンドをもたらす取引機会を効果的に捉えることができます.この戦略のパフォーマンスは,パラメータ設定,指標選択およびリスク管理方法をさらに最適化すれば,大きく向上する余地があります.
/*backtest
start: 2023-01-12 00:00:00
end: 2024-01-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//@SoftKill21
strategy(title="CRYPTO HA Strategy", shorttitle="CRYPTO HA Strategy", overlay=true , default_qty_type =strategy.percent_of_equity, default_qty_value =100, commission_type= strategy.commission.percent,commission_value =0.1 )
ma1_len = input(50)
ma2_len = input(100)
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
//monday and session
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
//First Moving Average data
o = ema(open, ma1_len)
c = ema(close, ma1_len)
h = ema(high, ma1_len)
l = ema(low, ma1_len)
// === HA calculator ===
ha_t = heikinashi(syminfo.tickerid)
ha_o = security(ha_t, timeframe.period, o)
ha_c = security(ha_t, timeframe.period, c)
ha_h = security(ha_t, timeframe.period, h)
ha_l = security(ha_t, timeframe.period, l)
//Second Moving Average data
o2 = ema(ha_o, ma2_len)
c2 = ema(ha_c, ma2_len)
h2 = ema(ha_h, ma2_len)
l2 = ema(ha_l, ma2_len)
// === Color def ===
ha_col = o2 > c2 ? color.white : color.lime
sell = o2 > c2 and o2[1] < c2[1] and time_cond
buy = o2 < c2 and o2[1] > c2[1] and time_cond
plotshape(buy, color=color.green, text= "Buy", location= location.belowbar,style= shape.labelup, textcolor=color.white, size = size.tiny, title="Buy Alert",editable=false, transp=60)
plotshape(sell, color=color.red, text= "Sell", location= location.abovebar,style= shape.labeldown, textcolor=color.white, size = size.tiny, title="Sell Alert", editable=false, transp=60)
trendColor = buy ? color.red : sell ? color.green : na
plot( buy ? close: sell ? close : na , color=trendColor, style=plot.style_line, linewidth=4, editable=false)
onlylong=input(true)
original=input(false)
if(onlylong)
strategy.entry("long",1,when=buy)
strategy.close("long",when=sell)
if(original)
strategy.entry("long",1,when=buy)
strategy.entry("short",0,when=sell)
sl = input(0.075)
strategy.exit("closelong", "long" , loss = close * sl / syminfo.mintick, alert_message = "sl point")
strategy.exit("closeshort", "short" , loss = close * sl / syminfo.mintick, alert_message = "sl point")