
この戦略は,累積RSI指標のトレンド認識を利用して,RSI指標の累積値が重要な値を破るときに買入と売却を行う.この戦略は,市場ノイズを効果的にフィルターし,より長い線のトレンド取引機会をロックすることができます.
この戦略は,主に累積RSI指標に基づいて取引決定を行う.累積RSI指標は,RSI指標の累積値であり,パラメータcumlenを設定することにより,RSI指標の数値をcumlen日間で累積して累積RSI指標を得ることができます.この指標は,短期市場のノイズをフィルターすることができます.
累積RSI指標でボリンジャー帯を横切ったとき,買入開設操作が行われ,累積RSI指標でボリンジャー帯を横切ったとき,平仓操作が行われる. ボリンジャー帯を横切ったとき,過去数年のデータから計算され,動態の変化の基準価格である.
さらに,戦略はトレンドフィルターオプションを追加した. 100日移動平均より高い価格,つまりトレンドの上昇チャネルにある場合にのみ,買い出し開店が行われる. このフィルターは,価格の揺れ時に誤った取引を防ぐことができる.
累積RSI突破戦略は,全体的に流暢で論理的に明確で,累積RSI指標によって効果的波動をシフトし,トレンド判断を増加させ,中長線トレンドを正確に把握し,歴史の反省パフォーマンスを優れています.しかし,パラメータの設定を調整し,判断指標を増加させ,平準ポジション条件を豊かにすることで,より健壮で包括的なトレンド戦略を構築するために,最適化できる余地があります.この戦略のアイデアは,さらなる探索と応用に値する新しいものです.
/*backtest
start: 2023-09-26 00:00:00
end: 2023-10-26 00:00:00
period: 1h
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/
// @version=5
// Author = TradeAutomation
strategy(title="Cumulative RSI Strategy", shorttitle="CRSI Strategy", process_orders_on_close=true, overlay=true, commission_type=strategy.commission.cash_per_contract, commission_value=.0035, slippage = 1, margin_long = 75, initial_capital = 25000, default_qty_type=strategy.percent_of_equity, default_qty_value=110)
// Cumulative RSI Indicator Calculations //
rlen = input.int(title="RSI Length", defval=3, minval=1)
cumlen = input(3, "RSI Cumulation Length")
rsi = ta.rsi(close, rlen)
cumRSI = math.sum(rsi, cumlen)
ob = (100*cumlen*input(94, "Oversold Level")*.01)
os = (100*cumlen*input(20, "Overbought Level")*.01)
// Operational Function //
TrendFilterInput = input(false, "Only Trade When Price is Above EMA?")
ema = ta.ema(close, input(100, "EMA Length"))
TrendisLong = (close>ema)
plot(ema)
// Backtest Timeframe Inputs //
startDate = input.int(title="Start Date", defval=1, minval=1, maxval=31)
startMonth = input.int(title="Start Month", defval=1, minval=1, maxval=12)
startYear = input.int(title="Start Year", defval=2010, minval=1950, maxval=2100)
endDate = input.int(title="End Date", defval=1, minval=1, maxval=31)
endMonth = input.int(title="End Month", defval=1, minval=1, maxval=12)
endYear = input.int(title="End Year", defval=2099, minval=1950, maxval=2100)
InDateRange = (time >= timestamp(syminfo.timezone, startYear, startMonth, startDate, 0, 0)) and (time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0))
// Buy and Sell Functions //
if (InDateRange and TrendFilterInput==true)
strategy.entry("Long", strategy.long, when = ta.crossover(cumRSI, os) and TrendisLong, comment="Buy", alert_message="buy")
strategy.close("Long", when = ta.crossover(cumRSI, ob) , comment="Sell", alert_message="Sell")
if (InDateRange and TrendFilterInput==false)
strategy.entry("Long", strategy.long, when = ta.crossover(cumRSI, os), comment="Buy", alert_message="buy")
strategy.close("Long", when = ta.crossover(cumRSI, ob), comment="Sell", alert_message="sell")
if (not InDateRange)
strategy.close_all()