인도 시장 통합 돌파 거래 전략


생성 날짜: 2023-12-15 11:59:08 마지막으로 수정됨: 2023-12-15 11:59:08
복사: 1 클릭수: 610
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

인도 시장 통합 돌파 거래 전략

개요

이 전략은 인도 주식 시장의 일일 거래에 적용되는 통합 돌파 지시 전략이다. 그것은 시간 조건, 위탁 수수료 및 중지 추적을 결합한다. 이 전략의 장점은 논리적으로 명확하고, 매개 변수를 조정하는 유연하며, 시장의 변화에 적응할 수 있다. 그러나 또한 특정 위험이 있으며, 추가 최적화가 필요하다.

전략 원칙

이 전략의 핵심 논리는 브린 밴드 지표에 기반한다. 그것은 길이가 LENGTH의 간단한 이동 평균을 중축으로 사용하며, 상반도와 하반도 각각 MULT의 표준 차이를 계산한다.

위험을 통제하기 위해, ATR 지표와 함께 스톱로스 라인을 계산했다. 또한 인도 주식 시장의 거래 시간을 고려하여 14:57 분에 모든 포지션을 완전히 평정했다.

우위 분석

이 전략에는 다음과 같은 장점이 있습니다.

  1. 명확한 논리, 변수 조정, 시장 상황에 적응할 수 있는 유연성
  2. 스톱로스 및 타임 컨트롤 로직을 통합하여 위험을 효과적으로 제어할 수 있습니다.
  3. 호환성: 인도 주식 시장의 특수한 거래 메커니즘을 고려하여 현지 환경에 적응합니다.
  4. 거래 빈도가 적고, 과도한 거래는 피하세요.
  5. 확장성이 좋아서 알고리즘을 최적화할 수 있다.

위험 분석

이 전략에는 위험도 있습니다.

  1. 브린베드의 파라미터 설정은 경험에 의존하고, 모든 환경에 적합하지 않다.
  2. 단 하나의 지표는 잘못된 신호를 만들어 낼 수 있습니다.
  3. ATR 상쇄는 부분적인 위험만을 효과적으로 제어할 수 있습니다.
  4. 주요 블랙 스완 사건의 영향은 고려되지 않았습니다.

위험은 다음과 같은 방법으로 줄일 수 있습니다.

  1. 다중 지표 필터링 신호 결합
  2. 최적화 변수 설정 규칙
  3. 공중공간 판단과 함께
  4. 제약 알고리즘의 거친성을 높이는 것
  5. 시장 감정 지표와 함께

최적화 방향

이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.

  1. 더 적응할 수 있도록 최적화된 변수 설정 규칙
  2. 잘못된 신호를 피하기 위해 여러 지표를 추가합니다.
  3. 최적화 및 강화 손해 방지 알고리즘의 거친성
  4. 트렌드 방향에 대한 분석 방법
  5. 포지션 크기를 자동으로 조정하는 것을 고려하십시오.

알고리즘과 모델의 최적화를 통해, 이 전략의 파라미터 튜닝 및 신호 필터링 능력을 향상시킬 수 있으며, 이를 통해 보다 광범위한 시장 환경에 적응할 수 있으며, 더 큰 위험을 감수할 수 있다.

요약하다

이 전략은 전반적으로 명확하고 이해하기 쉬운 일일 돌파 거래 전략이다. 그것은 인도 시장의 특성을 고려하고 거래 위험을 통제한다. 이 전략에는 특정 장점이 있으며 최적화 할 수있는 공간이 있습니다. 파라미터 튜닝 및 신호 필터링과 같은 방법을 개선하면 이 전략이 비즈니스 운영 요구 사항을 충족시킬 수 있습니다.

전략 소스 코드
/*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)