골든 크로스 이동 평균선 돌파 볼린저 밴드 전략


생성 날짜: 2023-11-21 12:01:25 마지막으로 수정됨: 2023-11-21 12:01:25
복사: 0 클릭수: 823
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

골든 크로스 이동 평균선 돌파 볼린저 밴드 전략

개요

이 전략은 이동 평균 지표, 부린 띠 지표 및 거래량 가중 평균 가격 지표를 결합하여 금포크 형성, 짧은 평균선에서 긴 평균선을 통과하는 조건에서 진입을 판단한다. 전략은 부린 띠 통로를 이용해서 가격이 부린 띠 아래 궤도를 건드렸을 때만 진입을 고려하여 시장의 변동에 자주 진출하는 것을 피한다.

전략 원칙

이 전략은 주로 평균선 지표를 통해 트렌드 방향을 판단하고, 부린을 이용하여 위치 변동의 범위를 선택하여 구매점을 선택한다. 구체적으로, 전략에는 다음과 같은 몇 가지 핵심 규칙이 포함되어 있다:

  1. 50일 EMA와 200일 EMA를 사용하여 금포 판단 시스템을 구축하고, 빠른 이동 평균에서 느린 이동 평균을 가로질러 다면 상승 추세에 있다고 간주합니다.

  2. VWAP보다 가격이 높을 때, 가격 상승 단계에 있다고 생각하여 더 많은 입장을 구축하는 것이 좋습니다.

  3. 가격이 부린의 하향 궤도를 만지거나 돌파했을 때, 주가가 반발점 근처에 있을 수 있음을 나타냅니다.

  4. 다자 포지션에 들어갔을 때, 가격이 브린을 초과하여 철회할 수 있습니다.

이 규칙의 조합을 통해, 이 전략은 황소 시장에서, 적절한 매수점을 선택하여 구매할 수 있고, 수익을 보장하기 위해 스톱 로스 스톱을 설정할 수 있다.

전략적 이점

  • 금강 판단 시스템을 이용하여 큰 트렌드 방향을 결정하고, 충격적인 상황에서 소소한 승패를 피한다.

  • VWAP 지표는 가격 변동 방향을 판단하여 구매 지점을 더 정확하게 선택할 수 있습니다.

  • 브린 띠 지표는 구매 지점을 판단하여 전략을 더욱 견고하게 만들며, 수익을 고정하기 위해 스톱 스톱을 설정합니다.

  • 여러 지표가 서로 검증되어서 전략적 판단이 더 정확하고 신뢰할 수 있습니다.

전략적 위험과 해결 방법

  • 골드포크 판단 시스템은 잘못된 신호를 발산할 수 있으며, 평행주기 길이를 적절히 줄이고, 다른 지표 검증과 협력해야 한다.

  • 부린밴드 파라미터를 잘못 설정하면 전략이 무효가 될 수 있으며, 부린밴드 주기 및 표준편차 파라미터를 조정해야 한다.

  • 중지 손실 지점은 너무 느슨하게 설정되어 손실을 효과적으로 제어 할 수 없습니다. 중지 손실 범위를 적절히 강화하여 위험을 제어 할 수 있도록해야합니다.

전략 최적화 방향

  • 골드 포크 평선 조합을 최적화하고, 다른 평선 파라미터를 테스트하여 최적의 파라미터를 찾습니다.

  • 다양한 주기 브린 벨트 파라미터를 테스트하여, 진폭과 분산성의 최적의 파라미터 조합을 찾습니다.

  • 테스트 및 최적화 스포드 레인지, 위험은 효과적으로 제어 할 수 있지만 너무 쉽게 유발되지 않습니다.

요약하다

이 전략은 종합적으로 평행 시스템, 브린 밴드 및 VWAP 지표를 사용하여 진출 시기를 판단하여 발견 기회와 제어 위험을 균형을 맞추고 있습니다. 후속 매개 변수 최적화 및 규칙 수정으로 업계 및 시장에서 지속적인 좋은 기회를 확보 할 수 있습니다.

전략 소스 코드
/*backtest
start: 2022-11-14 00:00:00
end: 2023-11-20 00:00:00
period: 1d
basePeriod: 1h
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/
// © mohanee

//@version=4
strategy(title="VWAP and BB strategy [$$]", overlay=true,pyramiding=2, default_qty_value=1, default_qty_type=strategy.fixed,    initial_capital=10000, currency=currency.USD)


fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 6, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
 
// To Date Inputs
toDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 8, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)
 
// Calculate start/end date and time condition
DST = 1 //day light saving for usa
//--- Europe
London = iff(DST==0,"0000-0900","0100-1000")
//--- America
NewYork = iff(DST==0,"0400-1300","0500-1400")
//--- Pacific
Sydney = iff(DST==0,"1300-2200","1400-2300")
//--- Asia
Tokyo = iff(DST==0,"1500-2400","1600-0100")

//-- Time In Range
timeinrange(res, sess) => time(res, sess) != 0

london = timeinrange(timeframe.period, London)
newyork = timeinrange(timeframe.period, NewYork)

startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = time >= startDate and time <= finishDate 


is_price_dipped_bb(pds,source1) =>
    t_bbDipped=false
    for i=1 to pds
        t_bbDipped:=  (t_bbDipped   or  close[i]<source1) ? true : false
        if t_bbDipped==true
            break
        else
            continue
            
    t_bbDipped


is_bb_per_dipped(pds,bbrSrc) =>
    t_bbDipped=false
    for i=1 to pds
        t_bbDipped:=  (t_bbDipped   or  bbrSrc[i]<=0) ? true : false
        if t_bbDipped==true
            break
        else
            continue
            
    t_bbDipped
    

// variables  BEGIN
shortEMA = input(50, title="fast EMA", minval=1)
longEMA = input(200, title="slow EMA", minval=1)

//BB

smaLength = input(7, title="BB SMA Length", minval=1)
bbsrc = input(close, title="BB Source")

strategyCalcOption = input(title="strategy to use", type=input.string, options=["BB", "BB_percentageB"],      defval="BB")



//addOnDivergence = input(true,title="Add to existing on Divergence")
//exitOption = input(title="exit on RSI or BB", type=input.string, options=["RSI", "BB"],      defval="BB")

//bbSource = input(title="BB  source", type=input.string, options=["close", "vwap"],      defval="close")
     
//vwap_res = input(title="VWAP Resolution", type=input.resolution, defval="session")
stopLoss = input(title="Stop Loss%", defval=1, minval=1)

//variables  END

longEMAval= ema(close, longEMA)
shortEMAval= ema(close, shortEMA)
ema200val = ema(close, 200)


vwapVal=vwap(close)



// Drawings

//plot emas
plot(shortEMAval, color = color.green, linewidth = 1, transp=0)
plot(longEMAval, color = color.orange, linewidth = 1, transp=0)
plot(ema200val, color = color.purple, linewidth = 2, style=plot.style_line ,transp=0)



//bollinger calculation 
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(bbsrc, smaLength)
dev = mult * stdev(bbsrc, smaLength)
upperBand = basis + dev
lowerBand = basis - dev
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)

bbr = (bbsrc - lowerBand)/(upperBand - lowerBand) 
//bollinger calculation 

//plot bb
//plot(basis, "Basis", color=#872323, offset = offset)
p1 = plot(upperBand, "Upper", color=color.teal, offset = offset)
p2 = plot(lowerBand, "Lower", color=color.teal, offset = offset)
fill(p1, p2, title = "Background", color=#198787, transp=95)


plot(vwapVal, color = color.purple, linewidth = 2, transp=0)


// Colour background

//barcolor(shortEMAval>longEMAval and close<=lowerBand ? color.yellow: na)
  

//longCondition=  shortEMAval > longEMAval and  close>open and  close>vwapVal
longCondition=  ( shortEMAval > longEMAval  and close>open and close>vwapVal and close<upperBand ) //and time_cond //     and  close>=vwapVal 



//Entry
strategy.entry(id="long", comment="VB LE" , long=true,  when= longCondition and ( strategyCalcOption=="BB"? is_price_dipped_bb(10,lowerBand) : is_bb_per_dipped(10,bbr)  )   and strategy.position_size<1 )   //is_price_dipped_bb(10,lowerBand))  //and strategy.position_size<1       is_bb_per_dipped(15,bbr) 


//add to the existing position
strategy.entry(id="long", comment="Add" , long=true,  when=strategy.position_size>=1 and close<strategy.position_avg_price and close>vwapVal) //and time_cond)

barcolor(strategy.position_size>=1  ? color.blue: na)



strategy.close(id="long", comment="TP Exit",   when=crossover(close,upperBand) )

//stoploss
stopLossVal =   strategy.position_avg_price * (1-(stopLoss*0.01) )
//strategy.close(id="long", comment="SL Exit",   when= close < stopLossVal)

//strategy.risk.max_intraday_loss(stopLoss, strategy.percent_of_equity)