
この戦略は,インド株式市場の日内取引 (Intraday) に適用される統合突破指示策である.これは時間条件,委託手数料,およびストップ・ローズ・トラッキングを組み合わせている.この戦略の優点は,論理的明快さ,パラメータの調整の柔軟性,市場の変化に適応できる点である.しかし,一定のリスクがあり,さらなる最適化が必要である.
この戦略の核心的な論理はブリン帯指数に基づいています.それは,長さがLENGTHの単純な移動平均を中軸として使用し,上線と下線をそれぞれMULT倍数の標準差で計算しています. 閉店価格が下線から軌道に突入するときに買入シグナルを生成し,閉店価格が上線から軌道に突入するときに売出シグナルを生成し,Range Breakout取引戦略を形成しています.
リスク管理のため,ATR指数と組み合わせてストップローンを計算した.また,インド株式市場の取引時間を考慮して,14:57分に全ポジションを平らにした.
この戦略には以下の利点があります.
この戦略にはいくつかのリスクがあります.
リスクは以下の方法で軽減できます.
この戦略は以下の方向から最適化できます.
アルゴリズムとモデルの最適化により,この戦略のパラメータチューニングとシグナルフィルタリングの能力を向上させることができ,より広範な市場環境に適応し,より大きなリスクを負うことができます.
この戦略は,全体として,明確で分かりやすい日内突破取引戦略である.これは,インド市場の特性を考慮し,取引リスクを制御している.この戦略には一定の優位性があり,最適化できる余地もある.パラメータチューニングやシグナルフィルタリングなどの方法の改善により,この戦略は,商業運営の要求を満たすことができる.
/*backtest
start: 2022-12-08 00:00:00
end: 2023-12-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Consolidation Breakout [Indian Market Timing]",overlay = true , pyramiding = 0 ,initial_capital = 50000, default_qty_value=5, currency = currency.NONE,commission_type = strategy.cash, commission_value = 30, slippage = 1 )
// ══════════════════════════════════//
// ————————> INPUT VALUES <————————— //
// ══════════════════════════════════//
LENGTH = input.int(title='LENGTH', defval = 75, minval = 10 ,maxval = 300)
MULT = input.float(title='MULT_STDEV',defval = 3.2 , minval = 1 , maxval = 7 , step =0.1)
//EMA1 = input.int(title='EMA1', defval = 50, minval = 10 ,maxval = 550)
//EMA2 = input.int(title='EMA2', defval = 135, minval = 10 ,maxval = 550)
factor_tr = input.float(title = "ATR TRAIL", defval = 10, step = 0.1)
// ══════════════════════════════════//
// ————————> DAY TIME LIMIT <——————— //
// ══════════════════════════════════//
t = time(timeframe.period, '0935-1430:1234567')
time_condition = not na(t)
//**********************// ════════════════════════════════//
//**********************// ————————> ATR & PLOT <————————— //
//**********************// ════════════════════════════════//
//ema1 = ta.ema(close,EMA1)
//ema2 = ta.ema(close,EMA2)
//plot(ema1, color=color.new(color.blue, 0), style=plot.style_linebr, title='ema1')
//plot(ema2, color=color.new(color.yellow, 0), style=plot.style_linebr, title='ema2')
atr_tr = ta.atr(16)*factor_tr
longStop = close - atr_tr
shortStop = close + atr_tr
Entry = close
length = LENGTH
mult = MULT
basis = ta.sma(Entry , length)
dev = mult * ta.stdev(Entry , length)
upper = (basis + dev)
lower = (basis - dev)
buyEntry = ta.crossover(Entry , upper)
sellEntry = ta.crossunder(Entry , lower)
//plot(upper, color=color.new(color.red, 0), style=plot.style_linebr, title="short stop")
//plot(lower, color=color.new(color.green, 0), style=plot.style_linebr, title="Long stop")
plot(upper, color=close[1] > upper and close > upper ? color.green : color.red, linewidth=2)
plot(lower, color=close[1] > lower and close > lower ? color.green : color.red, linewidth=2)
// ══════════════════════════════════//
// ————————> LONG POSITIONS <————————//
// ══════════════════════════════════//
//******barinstate.isconfirmed used to avoid repaint in real time*******
if ( buyEntry and strategy.opentrades==0 and barstate.isconfirmed and time_condition)
strategy.entry(id= "Long" ,direction = strategy.long, comment = "B")
plot(longStop , color=color.new(color.blue, 0), style=plot.style_linebr, title='long Stop')
if strategy.position_size > 0
strategy.exit("long tsl", "Long" , stop = longStop , comment='S')
// ═════════════════════════════════════//
// ————————> SHORT POSITIONS <————————— //
// ═════════════════════════════════════//
if ( sellEntry and strategy.opentrades==0 and barstate.isconfirmed and time_condition)
strategy.entry(id = "Short" ,direction = strategy.short, comment = "S")
if strategy.position_size < 0
strategy.exit("short tsl", "Short" , stop = shortStop ,comment='B')
// ════════════════════════════════════════════════//
// ————————> CLOSE ALL POSITIONS BY 3PM <————————— //
// ════════════════════════════════════════════════//
strategy.close_all(when = hour == 14 and minute == 57)