
この策略は,低波動方向の買入ストップ・損失策略と呼ばれています.これは,移動平均の交差を買入信号として使用し,ストップ・損失と組み合わせて利益をロックし,低波動区間の通貨に適用されます.
この戦略は3つの異なる周期の移動平均を使用します:50周期,100周期,200周期. 購入の論理は,50周期ラインが100周期ラインを横切ると,そして100周期ラインが200周期ラインを横切ると,追加入場を行います.
この信号は,市場が低波動区間から突破し,トレンド状態に入ろうとしていることを示している.50周期の急速な上昇は,短期間の内部力の突然の強化を意味し,中長線を上方へ駆動し始めていることを示している.100周期の線も,中期的な力の加入を意味し,安定した上向きの動きを示している.
入場後,ストップ・ストップ・ロスの方法で利潤をロックする戦略. ストップ・ストップ・目標は入場価格の8%,ストップ・ロスのラインは入場価格の4%である. ストップ・ストップをストップよりも大きく設定し,損失を上回る利得を有利に設定し,戦略の全体的な収益性を確保する.
この戦略の利点は以下の通りです.
この戦略にはいくつかのリスクがあります.
対策として
この戦略は以下の点で最適化できます.
概要として,この戦略は,全体的な運行論理が明確であり,移動平均周期とストップ・ストップ・損失幅を配置することで,低リスクの利益を得ることができ,量化取引に柔軟に適用できます.その後,入場信号,ストップ・損失方法などから最適化することができ,パラメータ調整に合わせて最適な効果を探します.
/*backtest
start: 2023-12-10 00:00:00
end: 2023-12-17 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(shorttitle='Low volatility Buy w/ TP & SL (by Coinrule)',title='Low volatility Buy w/ TP & SL', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 10, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2019, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
//MA inputs and calculations
movingaverage_fast = sma(close, input(50))
movingaverage_slow = sma(close, input(200))
movingaverage_normal= sma(close, input(100))
//Entry
strategy.entry(id="long", long = true, when = movingaverage_slow > movingaverage_normal and movingaverage_fast > movingaverage_normal)
//Exit
longStopPrice = strategy.position_avg_price * (1 - 0.04)
longTakeProfit = strategy.position_avg_price * (1 + 0.08)
strategy.close("long", when = close < longStopPrice or close > longTakeProfit and window())
//PLOT
plot(movingaverage_fast, color=color.orange, linewidth=2)
plot(movingaverage_slow, color=color.purple, linewidth=3)
plot(movingaverage_normal, color=color.blue, linewidth=2)