
Chiến lược này là một chiến lược chỉ dẫn đột phá được tích hợp cho giao dịch trong ngày trên thị trường chứng khoán Ấn Độ. Nó kết hợp các điều kiện thời gian, phí ủy thác và theo dõi dừng lỗ. Ưu điểm của chiến lược này là logic rõ ràng, tham số điều chỉnh linh hoạt, có thể thích ứng với sự thay đổi của thị trường.
Lịch lý cốt lõi của chiến lược này dựa trên chỉ số Brin. Nó sử dụng đường trung bình di chuyển đơn giản với chiều dài là LENGTH làm trục trung tâm, đường trên và đường dưới được tính theo chênh lệch chuẩn gấp đôi MULT.
Để kiểm soát rủi ro, nó kết hợp với chỉ số ATR để tính toán đường dừng lỗ. Ngoài ra, tính đến thời gian giao dịch của thị trường chứng khoán Ấn Độ, tất cả các vị trí được thanh toán hoàn toàn trong 14:57.
Chiến lược này có một số lợi thế:
Chiến lược này cũng có một số rủi ro:
Bạn có thể làm giảm nguy cơ bằng cách:
Chiến lược này có thể được tối ưu hóa theo các hướng sau:
Bằng cách tối ưu hóa thuật toán và mô hình, khả năng điều chỉnh tham số và lọc tín hiệu của chiến lược có thể được nâng cao để thích ứng với môi trường thị trường rộng lớn hơn và có thể chịu rủi ro lớn hơn.
Chiến lược này nói chung là một chiến lược giao dịch đột phá trong ngày rõ ràng và dễ hiểu. Nó xem xét các đặc điểm của thị trường Ấn Độ, kiểm soát rủi ro giao dịch. Chiến lược này có một số ưu điểm và có thể tối ưu hóa.
/*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)