この戦略は,強いトレンドと有利なタイミングを識別し,損失制御のショートライン取引を実現する. 戦略は,価格が単純移動平均のトレンドシグナルを突破することを追跡し,RSIが超買い超売りゾーンから逸脱すると,短期価格の急落を捕捉するために,時効的なストップ・ロスを停止する.
多周期単行移動平均を計算する
9日線,50日線,100日線をそれぞれ設定したSMA
短周期線を長周期線で切り抜け,トレンドの方向を判断する
RSIは過剰買いと過剰売れを判断する
RSIの長さは 14 サイクルに設定します.
RSIが70以上なら 超買い,30以下なら 超売り
価格が9日線を突破すると入場
価格が9日線を突破すると,さらに上昇します.
価格が9日線を下回ったとき空白
RSIがTHENJournalから離れるとストップダストが形成される
RSIが価格から離れる
RSIが設定されたパラメータに達すると停止します.
短期トレンドを追跡し,高周波取引に適しています.
移動平均のポートフォリオはトレンドの方向を判断し,誤った取引を避ける
RSIはリスクのタイミングを判断し, リスクをコントロールします.
フレキシブルなストップ・ロスト・ストップ,ショート・ライン・ローキング
戦略の安定性を向上させる指標信号
短期的なトレンド判断は誤りになり,上昇や低下を追う
RSIは誤った信号を発し,損失を拡大した.
ストップダストのパラメータを誤って設定し,利益を減らすか損失を拡大する
取引の頻度が高くなり,取引コストと滑り点を増加させる
パラメータの誤りと異常市場の影響策の効果
最適化パラメータの設定,厳格な止損,コスト管理を考慮する
異なる移動平均の組み合わせをテストし,判断を最適化する
RSI信号を検証するSTOCHなどの他の指標を考慮する
機械学習による 突破の判断の有効性
異なる品種と取引時期に対応するパラメータの調整
ストップダストストップロジックを最適化し,ダイナミック・トラッキングを実現
自動配属の統合を検討する
この戦略は,均線指標とRSI指標の優位性を統合し,保守的なショートライン取引戦略を実現する.パラメータ最適化,信号検証,リスク制御などによって戦略をより完善化し,市場の変化に適応して継続的な効果を得ることができる.移動平均の組み合わせを拡張し,機械学習などの方法により戦略の効果を向上させることができる.継続的な最適化の中で成熟する.
/*backtest
start: 2023-08-27 00:00:00
end: 2023-09-26 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Coinrule
//@version=4
strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//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() => true // create function "within window of time"
//MA inputs and calculations
movingaverage_fast = sma(close, input(9))
movingaverage_mid= sma(close, input(50))
movingaverage_slow = sma(close, input (100))
//Trend situation
Bullish= cross(close, movingaverage_fast)
Momentum = movingaverage_mid > movingaverage_slow
// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)
//Entry
strategy.entry(id="long", long = true, when = Bullish and Momentum and RSI > 50)
//Exit
TP = input(70)
SL =input(30)
longTakeProfit = RSI > TP
longStopPrice = RSI < SL
strategy.close("long", when = longStopPrice or longTakeProfit and window())
plot(movingaverage_fast, color=color.black, linewidth=2 )
plot(movingaverage_mid, color=color.orange, linewidth=2)
plot(movingaverage_slow, color=color.purple, linewidth=2)