
この戦略は,平均回転逆転戦略 (MARS) と名付けられており,その主な考えは,重要な平均線を下回った後に購入し,既定の目標利益に達した後に停止することである.
この戦略の主な原理は,短期平均線の逆転を利用して,整合的な市場情勢における反発の機会を捉えることである.具体的には,価格がより長い周期の平均線 (例えば20日線,50日線など) を破った後に強い超転の兆候を示している場合,市場変動の mean reversion特性のために,価格はしばしば一定量の反転を生じます.このとき,より短い周期の平均線 (例えば10日線) が上向きの反転の信号が発生した場合,それはより良い買い時である.この戦略に対応するものは,收盤価格が20日線より低く,50日線より高いときに買い,短線の逆転を利用して,その反転の動きを捉えることです.
この戦略の具体的な買取論理は,価格が20日線を下回った後に1手を買い,50日線を下回った後に1手を加仓し,100日線を下回った後に1手を加仓し,200日線を下回ると最大1手を加仓し,さらに4手を行う.既定のストップ目標に達した後に平仓する.同時に時間とストップ条件を設定する.
この戦略は,全体的に比較して古典的で一般的な均線取引戦略である.均線のスムージング特性を正しく利用し,同時に複数の均線を組み合わせて,短期的な買い時を識別する.分量的に倉庫を建設し,時 ਸਿਰストップをすることでリスクを制御する.しかし,市場突発的な出来事,例えば重要な政策のニュースなどの対応は,比較的被動的であり,これは最適化を続けることができる方向である.全体的に,パラメータ最適化とリスク管理の面で適切な改善を行った後,この戦略は,安定した余剰利益を得ることができる.
/*backtest
start: 2023-12-13 00:00:00
end: 2023-12-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA_zorba1", shorttitle="zorba_ema", overlay=true)
// Input parameters
qt1 = input.int(5, title="Quantity 1", minval=1)
qt2 = input.int(10, title="Quantity 2", minval=1)
qt3 = input.int(15, title="Quantity 3", minval=1)
qt4 = input.int(20, title="Quantity 4", minval=1)
ema10 = ta.ema(close, 10)
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
ema200 = ta.ema(close, 200)
// Date range filter
start_date = timestamp(year=2021, month=1, day=1)
end_date = timestamp(year=2024, month=10, day=27)
in_date_range = true
// Profit condition
profit_percentage = input(1, title="Profit Percentage") // Adjust this value as needed
// Pyramiding setting
pyramiding = input.int(2, title="Pyramiding", minval=1, maxval=10)
// Buy conditions
buy_condition_1 = in_date_range and close < ema20 and close > ema50 and close < open and close < low[1]
buy_condition_2 = in_date_range and close < ema50 and close > ema100 and close < open and close < low[1]
buy_condition_3 = in_date_range and close < ema100 and close > ema200 and close < open and close < low[1]
buy_condition_4 = in_date_range and close < ema200 and close < open and close < low[1]
// Exit conditions
profit_condition = strategy.position_avg_price * (1 + profit_percentage / 100) <= close
exit_condition_1 = in_date_range and (close > ema10 and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]
exit_condition_2 = in_date_range and (close < ema10 and close[1] > ema10 and close < close[1] and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]
// Exit condition for when today's close is less than the previous day's low
//exit_condition_3 = close < low[1]
// Strategy logic
strategy.entry("Buy1", strategy.long, qty=qt1 * pyramiding, when=buy_condition_1)
strategy.entry("Buy2", strategy.long, qty=qt2 * pyramiding, when=buy_condition_2)
strategy.entry("Buy3", strategy.long, qty=qt3 * pyramiding, when=buy_condition_3)
strategy.entry("Buy4", strategy.long, qty=qt4 * pyramiding, when=buy_condition_4)
strategy.close("Buy1", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy2", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy3", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy4", when=exit_condition_1 or exit_condition_2)