この戦略は,複数の移動平均値とモメントブレークスルーに基づいた取引戦略である.この戦略は,SMMA (スムーズ移動平均値) とZLEMA (ゼロ・ラグ指数移動平均値) などの技術指標を組み合わせ,価格と移動平均値間のクロスオーバー信号をキャプチャすることによって取引機会を特定する.この戦略は,取引の正確性を向上させるために,市場の波動性に基づいて信号敏感性を調整する適応メカニズムを使用する.
この戦略は, src (SMMA based on HLC3), hi (SMMA based on high), lo (SMMA based on low), mi (ZLEMA based on src) の4つの主要な移動平均値を使用している.取引信号は主にこれらの移動平均値間のクロスオーバー関係と相対的なポジションに基づいている.複数の信号条件の組み合わせは取引信号の信頼性を保証する.購入信号には4つの異なる条件組み合わせが含まれ,販売信号には4つの異なる条件組み合わせも含まれている.出口信号は,移動平均値とのMI平均値と相対的なポジションとの価格クロスオーバーに基づいている.
この戦略は,複数の移動平均値とモメントインジケーターを組み合わせることで比較的完全な取引システムを構築する. 戦略の適応機能と複数の確認メカニズムにより取引の信頼性が向上する. 最適化と精錬を通じて,戦略は異なる市場環境で安定したパフォーマンスを維持する可能性がある. トレーダーはライブ取引の前に徹底的なバックテストとパラメータ最適化を行うことをお勧めする.
/*backtest start: 2024-01-10 00:00:00 end: 2025-01-08 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=6 //study("Limit order strategy", overlay=true) strategy('Limit order strategy', overlay = true) lengthMA = input(1) lengthmi = input(14) lengthhigh = input(14) lengthlow = input(14) calc_smma(src, len) => smma = 0.0 smma := na(smma[1]) ? ta.sma(src, len) : (smma[1] * (len - 1) + src) / len smma calc_zlema(src, length) => ema1 = ta.ema(src, length) ema2 = ta.ema(ema1, length) d = ema1 - ema2 ema1 + d src = calc_smma(hlc3, lengthMA) hi = calc_smma(high, lengthhigh) lo = calc_smma(low, lengthlow) mi = calc_zlema(src, lengthmi) plot(src, color = color.new(#FF1493, 0), linewidth = 2, title = 'src') plot(hi, color = color.new(#7CFC00, 0), linewidth = 2, title = 'hi') plot(lo, color = color.new(#FF0000, 0), linewidth = 2, title = 'lo') plot(mi, color = color.new(#00FFFF, 0), linewidth = 2, title = 'mi') //strategy.order("buy", true, 1, stop = na, when = openbuy) // buy by market if current open great then previous high //strategy.order("sell", false, 1, stop = na, when = opensell) // sell by market if current open less then previous low //if src >= mi and src[1] <= mi[1] and src[1] <= lo[1] // strategy.entry("buy 1", strategy.long, qty = 15) sigorderbuy1 = src > mi and src[1] < mi[1] and src < lo and mi < lo sigorderbuy2 = src > lo and src[1] < lo[1] and mi < lo sigorderbuy3 = src > hi and src[1] < hi[1] and mi < hi sigorderbuy4 = src > mi and src[1] < mi[1] and src > hi and mi > hi //sigorderbuy5 = mi > hi and src > hi and src > mi and src[1] < mi[1] //sigorderbuy6 = mi < hi and src > hi and src[1] < hi[1] sigclosebuy = src < mi and src[1] > mi[1] or mi < lo and src < lo and src[1] > lo[1] sigordersell1 = src < mi and src[1] > mi[1] and src > hi and mi > hi sigordersell2 = src < hi and src[1] > hi[1] and mi > hi sigordersell3 = src < lo and src[1] > lo[1] and mi > lo sigordersell4 = src < mi and src[1] > mi[1] and src < lo and mi < lo //sigordersell5 = mi < lo and src < lo and src < mi and src[1] > mi[1] //sigordersell6 = mi > lo and src < lo and src[1] > lo[1] sigclosesell = src > mi and src[1] < mi[1] or mi > hi and src > hi and src[1] < hi[1] plot(sigorderbuy1 ? 1 : 0, 'sigorderbuy1') plot(sigorderbuy2 ? 1 : 0, 'sigorderbuy2') plot(sigorderbuy3 ? 1 : 0, 'sigorderbuy3') plot(sigorderbuy4 ? 1 : 0, 'sigorderbuy4') //plot(sigorderbuy5 ? 1 : 0,"sigorderbuy5") //plot(sigorderbuy6 ? 1 : 0,"sigorderbuy6") plot(sigordersell1 ? 1 : 0, 'sigordersell1') plot(sigordersell2 ? 1 : 0, 'sigordersell2') plot(sigordersell3 ? 1 : 0, 'sigordersell3') plot(sigordersell4 ? 1 : 0, 'sigordersell4') //plot(sigordersell5 ? 1 : 0,"sigordersell5") //plot(sigordersell6 ? 1 : 0,"sigordersell6") plot(sigclosebuy ? 1 : 0, 'sigclosebuy') plot(sigclosesell ? 1 : 0, 'sigclosesell') openbuy = sigorderbuy1 or sigorderbuy2 or sigorderbuy3 or sigorderbuy4 // or sigorderbuy5 or sigorderbuy6 opensell = sigordersell1 or sigordersell2 or sigordersell3 or sigordersell4 //or sigordersell5 or sigordersell6 openclosebuy = sigclosebuy openclosesell = sigclosesell alertcondition(condition = openbuy, title = 'sigorderbuy all', message = '{"accountmt":"70415621,666734890","time":"15","msg":"Buy {{ticker}} sig_b1={{plot("sigorderbuy1")}} sig_b2={{plot("sigorderbuy2")}} sig_b3={{plot("sigorderbuy3")}} sig_b4={{plot("sigorderbuy4")}}"}') alertcondition(condition = opensell, title = 'sigordersell all', message = '{"accountmt":"70415621,666734890","time":"15","msg":"Sell {{ticker}} sig_s1={{plot("sigordersell1")}} sig_ss={{plot("sigordersell2")}} sig_s3={{plot("sigordersell3")}} sig_s4={{plot("sigordersell4")}} sig_s5={{plot("sigordersell5")}} sig_61={{plot("sigordersell6")}}"}') alertcondition(condition = sigclosebuy, title = 'Close buy', message = '{"accountmt":"70415621,666734890","time":"15","msg":"Close {{ticker}} T=short"}') alertcondition(condition = sigclosesell, title = 'Close sell', message = '{"accountmt":"70415621,666734890","time":"15","msg":"Close {{ticker}} T=long"}') if sigorderbuy1 strategy.order('Buy 1', strategy.long, 1) if sigorderbuy2 strategy.order('Buy 2', strategy.long, 1) if sigorderbuy3 strategy.order('Buy 3', strategy.long, 1) if sigorderbuy4 strategy.order('Buy 4', strategy.long, 1) if sigordersell1 strategy.order('sell 1', strategy.short, 1) if sigordersell2 strategy.order('sell 2', strategy.short, 1) if sigordersell3 strategy.order('sell 3', strategy.short, 1) if sigordersell4 strategy.order('sell 4', strategy.short, 1) //strategy.order("sell 5", false, 1, when = sigordersell5) //strategy.order("sell 6", false, 1, when = sigordersell6)