
이 전략은 동력 지표, 트렌드 지표, 이치모쿠 클라우드 그래프 등의 여러 요인을 종합적으로 고려하여 최종 구매 결정을 형성한다. 이 전략은 강한 안정성과 위험 저항력을 가지고 있다.
이 전략은 다음과 같은 주요 부분들로 구성됩니다.
동력 지표: Parabolic SAR, Leledc 강도 지표, Kaufman 적응 이동 평균 등
트렌드 지표: 라हुल 모힌다르 진동기, 트렌드 매직
이치모쿠 클라우드 지도: 텐칸 라인, 키 라인 등
수량 흐름 지표: Volume Flow Indicator
파동 지표: Wave Trend Oscillator
TD 서열
이 지표들은 각각 다른 관점에서 현재의 시장의 경향과 강도를 판단한다. Parabolic SAR는 트렌드 반전점을 판단하고, Ledc 강도 지표는 모멘텀을 판단하고, Ichimoku 클라우드 그래프는 지지 압력을 판단한다. 대부분의 지표들이 동방향 신호를 내놓을 때, 최종 구매 또는 판매 판단이 형성된다.
이 전략은 동시에 필터링 조건을 설정하여 매월, 매일의 지정된 날짜 범위 내에서만 거래하여 무효 거래의 횟수를 줄입니다.
다중 요소 통합 판단, 정확도 향상, 강력한 위험 저항력
단일 지표의 실패의 위험을 피하기 위해 다양한 유형의 지표를 사용하여 상호 검증하십시오.
필터링 조건을 설정하여 부적절한 시간에 유효하지 않은 거래를 방지합니다.
파인 스크립트를 사용하여 작성되어 TradingView 플랫폼에서 직접 사용할 수 있습니다.
지표의 매개 변수는 조정 가능하며, 다른 시장에 최적화 할 수 있습니다.
시장 구조를 직관적으로 판단할 수 있는 지표 신호를 시각화
다인자 조합은 무게와 변수를 조정해야하며, 최적화하기에는 약간의 어려움이 있습니다.
단일 지표는 특정 시장 상황에서는 유효하지 않을 수 있습니다.
필터링 조건을 잘못 설정하면 기회를 놓칠 수 있습니다.
지나친 최적화를 피하는 것이 중요합니다.
트레이더들은 지표의 실패에 주의를 기울이고, 전략을 조기에 조정해야 합니다.
대책:
현재 시장에 대한 더 효과적인 지표 변수를 최적화 조정
가중치를 조정하고, 유효한 지표의 역할을 높이고, 비효율적인 지표의 역할을 감소시킨다.
기회와 위험을 동시에 고려하여 필터링 조건을 적절하게 조정하십시오.
기계 학습 알고리즘을 추가하여 지표의 무게를 자동으로 조정합니다.
감정 지표, 자금 흐름 지표와 같은 더 많은 요소들을
거래 유형, 시간대에 대한 테스트, 최적의 매개 변수를 설정
다른 기간의 효과를 테스트하는 방법
더 많은 필터링 조건들, 예를 들어 계절적, 경제적인 데이터와 함께
추가된 스톱로스 전략
이 전략은 여러 지표를 통합하여 최종 판단을 형성하고, 위험 저항력이 강한 장점을 가지고 있다. 또한 단일 지표의 실패의 위험, 지속적인 최적화 및 조정 매개 변수를 주의해야 한다. 향후 지표 중량 설정을 추가적으로 최적화하고, 더 많은 요소를 추가하고, 최적의 포지션 기간을 테스트할 수 있다.
//@version=2
persistent_bull = nz(persistent_bull[1],0)
persistent_bear = nz(persistent_bear[1],0)
strategy("Strategy for The Bitcoin Buy/Sell Indicator", overlay=true, calc_on_every_tick=true)
// ****************************************Inputs***************************************************************
//@fixme if there is a buy and sell signal on the same bar, then it displays the first one and skips the second one. Fix this issue
buySellSignal = true // Make this false if you do not want to show Buy/Sell signal
inputIndividualSiganlPlot = true // = input (false, "Do you want to display each individual indicator's signal on the chart?")
sp = input (false, "Do you want to display Parabolic SAR?")
spLines = input (false, "Do you want to display Parabolic SAR on the chart?")
sCloud = input(false, "Do you want to display the Tenkan and Kijun lines of Ichimoku lines on the chart?")
sL = input (false, "Do you want to display Leledec Exhausion - Leledc on the chart?")
sTD = false
sRMO = input(false, "Do you want to display Rahul Mohindar Oscillator - RMO on the chart?")
inputAma = input(false, title="Do you want to display Kaufman AMA wave - AMA on the chart?")
tm = input (false, "Do you want to display Trend Magic signals on the chart?")
wtoLB = input (false, "Do you want to display WaveTrend Oscillator - WTO on the chart?")
vfiLB = input (false, "Do you want to display Volume Flow Indicator - VFI on the chart?")
cogRegionFillTransp = 100 // input(false, "Do you want to display COG Region Fill and ATR Starc+/-")
inputNeutralMinorSignals = input (false, title="Do you want to not display the minor or the not so strong signals from Ichimoku")
maj=true // input(true,title="Show Major Leledc Exhausion Bar signal")
min=input(false,title="Show Minor Leledc Exhausion Bar signal")
tenkanPeriods = input(20, minval=9, title="Tenkan Period - Ichimoku [9 or 10 or 20]")
kijunPeriods = input(60, minval=26, title="Kijun Period - Ichimoku [26 or 30 or 60]")
chikouPeriods = input(120, minval=52, title="Chikou - Ichimoku [52 or 60 or 120]")
displacement = input(30, minval=26, title="Displacement - Ichimoku [26 or 30]")
// ****************************************General Color Variables***************************************************************
colorLime = #006400 // Warning sign for long trade
colorBuy= #2DFF03 // Good sign for long trade
colorSell = #733629 // Good sign for short trade
colorMaroon =#8b0000 // Warning sign for short trade
colorBlue =#0000ff // No clear sign
colorGray = #a9a9a9 // Gray Color (For Squeeze momentum indicator)
colorBlack = #000000 // Black
colorWhite = #ffffff // White
colorTenkanViolet = #800000 // Tenkan-sen line color
colorKijun = #0000A6 // Kijun-sen line color
// TD Sequential bar colors
tdSell = #ff6666
tdSellOvershoot = #ff1a1a
tdSellOvershoot1 = #cc0000
tdSellOverShoot2 = #990000
tdSellOverShoot3 = #732626
tdBuy = #80ff80
tdBuyOverShoot = #33ff33
tdBuyOvershoot1 = #00cc00
tdBuyOverShoot2 = #008000
tdBuyOvershoot3 = #004d00
// ****************************************Icons***************************************************************
upSign = '↑' // indicates the indicator shows uptrend
downSign = '↓' // incicates the indicator showing downtrend
exitSign ='x' //indicates the indicator uptrend/downtrend ending
// diamond signals weakBullishSignal or weakBearishsignal
// flag signals neutralBullishSignal or neutralBearishSignal
// ****************************************Parabolic SAR code***************************************************************
start = 2
increment = 2
maximum = 2
sus = true
sds = true
disc = false
startCalc = start * .01
incrementCalc = increment * .01
maximumCalc = maximum * .10
sarUp = sar(startCalc, incrementCalc, maximumCalc)
sarDown = sar(startCalc, incrementCalc, maximumCalc)
colUp = spLines and close >= sarDown ? colorLime : na
colDown = spLines and close <= sarUp ? colorSell : na
//@fixme Does not display the correct values for up and down pSAR
plot(sp and sus and sarUp ? sarUp : na, title="↓ SAR", style=cross, linewidth=3,color=colUp)
plot(sp and sds and sarDown ? sarDown : na, title="↑ SAR", style=circles, linewidth=3,color=colDown)
startSAR = 0.02
incrementSAR = 0.02
maximumSAR = 0.2
psar = sar(startSAR, incrementSAR, maximumSAR)
bullishPSAR = psar < high and psar[1] > low
bearishPSAR= psar > low and psar[1] < high
//***********************Leledc Exhausion Bar***********************************************
maj_qual=6
maj_len=30
min_qual=5
min_len=5
lele(qual,len)=>
bindex=nz(bindex[1],0)
sindex=nz(sindex[1],0)
ret=0
if (close>close[4])
bindex:=bindex + 1
if(close<close[4])
sindex:=sindex + 1
if (bindex>qual) and (close<open) and high>=highest(high,len)
bindex:=0
ret:=-1
if ((sindex>qual) and (close>open) and (low<= lowest(low,len)))
sindex:=0
ret:=1
return=ret
major=lele(maj_qual,maj_len)
minor=lele(min_qual,min_len)
leledecMajorBullish = maj ? (major==1?low:na) : na
leledecMajorBearish = maj ? (major==-1?high:na) : na
//****************Ichimoku ************************************
donchian(len) => avg(lowest(len), highest(len))
tenkan = donchian(tenkanPeriods)
kijun = donchian(kijunPeriods)
senkouA = avg(tenkan, kijun)
senkouB = donchian(chikouPeriods)
displacedSenkouA = senkouA[displacement]
displacedSenkouB = senkouB[displacement]
bullishSignal = crossover(tenkan, kijun)
bearishSignal = crossunder(tenkan, kijun)
bullishSignalValues = iff(bullishSignal, tenkan, na)
bearishSignalValues = iff(bearishSignal, tenkan, na)
strongBullishSignal = crossover(tenkan, kijun) and bullishSignalValues > displacedSenkouA and bullishSignalValues > displacedSenkouB and low > tenkan and displacedSenkouA > displacedSenkouB
strongBearishSignal = bearishSignalValues < displacedSenkouA and bearishSignalValues < displacedSenkouB and high < tenkan and displacedSenkouA < displacedSenkouB
neutralBullishSignal = (bullishSignalValues > displacedSenkouA and bullishSignalValues < displacedSenkouB) or (bullishSignalValues < displacedSenkouA and bullishSignalValues > displacedSenkouB)
weakBullishSignal = bullishSignalValues < displacedSenkouA and bullishSignalValues < displacedSenkouB
neutralBearishSignal = (bearishSignalValues > displacedSenkouA and bearishSignalValues < displacedSenkouB) or (bearishSignalValues < displacedSenkouA and bearishSignalValues > displacedSenkouB)
weakBearishSignal = bearishSignalValues > displacedSenkouA and bearishSignalValues > displacedSenkouB
//*********************Kaufman AMA wave*********************//
src=close
lengthAMA=20
filterp = 10
d=abs(src-src[1])
s=abs(src-src[lengthAMA])
noise=sum(d, lengthAMA)
efratio=s/noise
fastsc=0.6022
slowsc=0.0645
smooth=pow(efratio*fastsc+slowsc, 2)
ama=nz(ama[1], close)+smooth*(src-nz(ama[1], close))
filter=filterp/100 * stdev(ama-nz(ama), lengthAMA)
amalow=ama < nz(ama[1]) ? ama : nz(amalow[1])
amahigh=ama > nz(ama[1]) ? ama : nz(amahigh[1])
bw=(ama-amalow) > filter ? 1 : (amahigh-ama > filter ? -1 : 0)
s_color=bw > 0 ? colorBuy : (bw < 0) ? colorSell : colorBlue
amaLongConditionEntry = s_color==colorBuy and s_color[1]!=colorBuy
amaShortConditionEntry = s_color==colorSell and s_color[1]!=colorSell
//***********************Rahul Mohindar Oscillator ******************************//
C=close
cm2(x) => sma(x,2)
ma1=cm2(C)
ma2=cm2(ma1)
ma3=cm2(ma2)
ma4=cm2(ma3)
ma5=cm2(ma4)
ma6=cm2(ma5)
ma7=cm2(ma6)
ma8=cm2(ma7)
ma9=cm2(ma8)
ma10=cm2(ma9)
SwingTrd1 = 100 * (close - (ma1+ma2+ma3+ma4+ma5+ma6+ma7+ma8+ma9+ma10)/10)/(highest(C,10)-lowest(C,10))
SwingTrd2=ema(SwingTrd1,30)
SwingTrd3=ema(SwingTrd2,30)
RMO= ema(SwingTrd1,81)
Buy=cross(SwingTrd2,SwingTrd3)
Sell=cross(SwingTrd3,SwingTrd2)
Bull_Trend=ema(SwingTrd1,81)>0
Bear_Trend=ema(SwingTrd1,81)<0
Ribbon_kol=Bull_Trend ? colorBuy : (Bear_Trend ? colorSell : colorBlue)
Impulse_UP= SwingTrd2 > 0
Impulse_Down= RMO < 0
bar_kol=Impulse_UP ? colorBuy : (Impulse_Down ? colorSell : (Bull_Trend ? colorBuy : colorBlue))
rahulMohindarOscilllatorLongEntry = Ribbon_kol==colorBuy and Ribbon_kol[1]!=colorBuy and Ribbon_kol[1]==colorSell and bar_kol==colorBuy
rahulMohindarOscilllatorShortEntry = Ribbon_kol==colorSell and Ribbon_kol[1]!=colorSell and Ribbon_kol[1]==colorBuy and bar_kol==colorSell
//***********************TD Sequential code ******************************//
transp=0
Numbers=false
SR=false
Barcolor=true
TD = close > close[4] ?nz(TD[1])+1:0
TS = close < close[4] ?nz(TS[1])+1:0
TDUp = TD - valuewhen(TD < TD[1], TD , 1 )
TDDn = TS - valuewhen(TS < TS[1], TS , 1 )
priceflip = barssince(close<close[4])
sellsetup = close>close[4] and priceflip
sell = sellsetup and barssince(priceflip!=9)
sellovershoot = sellsetup and barssince(priceflip!=13)
sellovershoot1 = sellsetup and barssince(priceflip!=14)
sellovershoot2 = sellsetup and barssince(priceflip!=15)
sellovershoot3 = sellsetup and barssince(priceflip!=16)
priceflip1 = barssince(close>close[4])
buysetup = close<close[4] and priceflip1
buy = buysetup and barssince(priceflip1!=9)
buyovershoot = barssince(priceflip1!=13) and buysetup
buyovershoot1 = barssince(priceflip1!=14) and buysetup
buyovershoot2 = barssince(priceflip1!=15) and buysetup
buyovershoot3 = barssince(priceflip1!=16) and buysetup
TDbuyh = valuewhen(buy,high,0)
TDbuyl = valuewhen(buy,low,0)
TDsellh = valuewhen(sell,high,0)
TDselll = valuewhen(sell,low,0)
//***********************Volume Flow Indicator [LazyBear] ******************************//
lengthVFI = 130
coefVFI = 0.2
vcoefVFI = 2.5
signalLength= 5
smoothVFI=true
ma(x,y) => smoothVFI ? sma(x,y) : x
typical=hlc3
inter = log( typical ) - log( typical[1] )
vinter = stdev(inter, 30 )
cutoff = coefVFI * vinter * close
vave = sma( volume, lengthVFI )[1]
vmax = vave * vcoefVFI
vc = iff(volume < vmax, volume, vmax)
mf = typical - typical[1]
vcp = iff( mf > cutoff, vc, iff ( mf < -cutoff, -vc, 0 ) )
vfi = ma(sum( vcp , lengthVFI )/vave, 3)
vfima=ema( vfi, signalLength )
dVFI=vfi-vfima
bullishVFI = vfi > 0 and vfi[1] <=0
bearishVFI = vfi < 0 and vfi[1] >=0
//***********************WaveTrend Oscillator [WT] ******************************//
n1 = 10
n2 = 21
obLevel1 = 60
obLevel2 = 53
osLevel1 = -60
osLevel2 = -53
ap = hlc3
esa = ema(ap, n1)
dWTI = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * dWTI)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1,4)
wtiSignal = wt1-wt2
bullishWTI = wt1 > osLevel1 and wt1[1] <= osLevel1 and wtiSignal > 0
bearishWTI = wt1 < obLevel1 and wt1[1] >= obLevel1 and wtiSignal < 0
// **************** Trend Magic code adapted from Glaz ********************* /
CCI = 20 // input(20)
ATR = 5 // input(5)
Multiplier=1 // input(1,title='ATR Multiplier')
original=true // input(true,title='original coloring')
thisCCI = cci(close, CCI)
lastCCI = nz(thisCCI[1])
bufferDn= high + Multiplier * sma(tr,ATR)
bufferUp= low - Multiplier * sma(tr,ATR)
if (thisCCI >= 0 and lastCCI < 0)
bufferUp := bufferDn[1]
if (thisCCI <= 0 and lastCCI > 0)
bufferDn := bufferUp[1]
if (thisCCI >= 0)
if (bufferUp < bufferUp[1])
bufferUp := bufferUp[1]
else
if (thisCCI <= 0)
if (bufferDn > bufferDn[1])
bufferDn := bufferDn[1]
x=thisCCI >= 0 ?bufferUp:thisCCI <= 0 ?bufferDn:x[1]
swap=x>x[1]?1:x<x[1]?-1:swap[1]
swap2=swap==1?lime:red
swap3=thisCCI >=0 ?lime:red
swap4=original?swap3:swap2
bullTrendMagic = swap4 == lime and swap4[1] == red
bearTrendMagic = swap4 == red and swap4[1] == lime
// ************ Indicator: Custom COG channel by Lazy Bear **************** //
srcCOG = close
lengthCOG = 34
median=0
multCOG= 2.5 // input(2.5)
offset = 20 //input(20)
tr_custom() =>
x1=high-low
x2=abs(high-close[1])
x3=abs(low-close[1])
max(x1, max(x2,x3))
atr_custom(x,y) =>
sma(x,y)
dev = (multCOG * stdev(srcCOG, lengthCOG))
basis=linreg(srcCOG, lengthCOG, median)
ul = (basis + dev)
ll = (basis - dev)
tr_v = tr_custom()
acustom=(2*atr_custom(tr_v, lengthCOG))
uls=basis+acustom
lls=basis-acustom
// Plot STDEV channel
plot(basis, linewidth=1, color=navy, style=line, linewidth=1, title="Median : STDEV COG")
lb=plot(ul, color=red, linewidth=1, title="BB+ : COG", style=hline.style_dashed)
tb=plot(ll, color=green, linewidth=1, title="BB- : COG ", style=hline.style_dashed)
fill(tb,lb, silver, title="Region fill: STDEV COG", transp=cogRegionFillTransp)
// Plot ATR channel
plot(basis, linewidth=2, color=navy, style=line, linewidth=2, title="Median : ATR COG ")
ls=plot(uls, color=red, linewidth=1, title="Starc+ : ATR COG", style=circles, transp=cogRegionFillTransp)
ts=plot(lls, color=green, linewidth=1, title="Star- : ATR COG", style=circles, transp=cogRegionFillTransp)
fill(ts,tb, green, title="Region fill : ATR COG", transp=cogRegionFillTransp)
fill(ls,lb, red, title="Region fill : ATR COG", transp=cogRegionFillTransp)
// Mark SQZ
plot_offs_high=0.002
plot_offs_low=0.002
sqz_f=(uls>ul) and (lls<ll)
b_color=sqz_f ? colorBlack : na
plot(sqz_f ? lls - (lls * plot_offs_low) : na, color=b_color, style=cross, linewidth=3, title="SQZ : COG", trasp=0)
plot(sqz_f ? uls + (uls * plot_offs_high) : na, color=b_color, style=cross, linewidth=3, title="SQZ : COG", trasp=0)
// ****************************************All the plots and coloring of bars***************************************************************
// Trend Magic
plotchar(tm and bullTrendMagic, title="TM", char=upSign, location=location.belowbar, color=colorBuy, transp=0, text="TM", textcolor=colorBuy, size=size.auto)
plotchar(tm and bearTrendMagic, title="TM", char=downSign, location=location.abovebar, color=colorSell, transp=0, text="TM", textcolor=colorSell, size=size.auto)
// WaveTrend Oscillator
plotshape(wtoLB and bullishWTI, color=colorBuy, style=shape.labelup, textcolor=#000000, text="WTI", location=location.belowbar, transp=0)
plotshape(wtoLB and bearishWTI, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="WTI", location=location.abovebar, transp=0)
// VFI
plotshape(vfiLB and bullishVFI, color=colorBuy, style=shape.labelup, textcolor=#000000, text="VFI", location=location.belowbar, transp=0)
plotshape(vfiLB and bearishVFI, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="VFI", location=location.abovebar, transp=0)
// PSAR
plotshape(inputIndividualSiganlPlot and sp and bullishPSAR, color=colorBuy, style=shape.labelup, textcolor=#000000, text="Sar", location=location.belowbar, transp=0)
plotshape(inputIndividualSiganlPlot and sp and bearishPSAR, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="Sar", location=location.abovebar, transp=0)
// Leledec
plotshape(inputIndividualSiganlPlot and sL and leledecMajorBearish, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="Leledec", location=location.abovebar, transp=0)
plotshape(inputIndividualSiganlPlot and sL and leledecMajorBullish, color=colorBuy, style=shape.labelup, textcolor=#000000, text="Leledec", location=location.belowbar, transp=0)
plotshape(min ? (minor==1?low:na) : na, style=shape.diamond, text="Leledec", size=size.tiny, location=location.belowbar, title="Weak Bullish Signals - Leledec", color=colorLime)
plotshape(min ? (minor==-1?high:na) : na, style=shape.diamond, text="Leledec", size=size.tiny, location=location.abovebar, title="Weak Bearish Signals - Leleded", color=colorSell)
// Ichimoku
plot(tenkan, color=iff(sCloud, colorTenkanViolet, na), title="Tenkan", linewidth=2, transp=0)
plot(kijun, color=iff(sCloud, colorKijun, na), title="Kijun", linewidth=2, transp=0)
plot(close, offset = -displacement, color=iff(sCloud, colorLime, na), title="Chikou", linewidth=1)
p1 = plot(senkouA, offset=displacement, color=colorBuy, title="Senkou A", linewidth=3, transp=0)
p2 = plot(senkouB, offset=displacement, color=colorSell, title="Senkou B", linewidth=3, transp=0)
fill(p1, p2, color = senkouA > senkouB ? #1eb600 : colorSell)
plotshape(inputIndividualSiganlPlot and strongBearishSignal, color=colorSell, style=shape.labelup, textcolor=#000000, text="Ichimoku", location=location.abovebar, transp=0)
plotshape(inputIndividualSiganlPlot and strongBullishSignal, color=colorBuy, style=shape.labeldown, textcolor=#ffffff, text="Ichimoku", location=location.belowbar, transp=0)
plotshape(inputNeutralMinorSignals and neutralBullishSignal, style=shape.flag, text="Ichimoku", size=size.small, location=location.belowbar, title="Neutral Bullish Signals - Ichimoku", color=colorLime)
plotshape(inputNeutralMinorSignals and weakBullishSignal, style=shape.diamond, text="Ichimoku", size=size.tiny, location=location.belowbar, title="Weak Bullish Signals - Ichimoku", color=colorLime)
plotshape(inputNeutralMinorSignals and neutralBearishSignal, style=shape.flag, text="Ichimoku", size=size.small, location=location.abovebar, title="Neutral Bearish Signals - Ichimoku", color=colorMaroon)
plotshape(inputNeutralMinorSignals and weakBearishSignal, style=shape.diamond, text="Ichimoku", size=size.tiny, location=location.abovebar, title="Weak Bearish Signals - Ichimoku", color=colorMaroon)
// AMA
plotshape(inputIndividualSiganlPlot and inputAma and amaLongConditionEntry, color=colorBuy, style=shape.labelup, textcolor=#000000, text="AMA", location=location.belowbar, transp=0)
plotshape(inputIndividualSiganlPlot and inputAma and amaShortConditionEntry, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="AMA", location=location.abovebar, transp=0)
// RMO
plotshape(inputIndividualSiganlPlot and sRMO and rahulMohindarOscilllatorLongEntry, color=colorBuy, style=shape.labelup, textcolor=#000000, text="RMO", location=location.belowbar, transp=0)
plotshape(inputIndividualSiganlPlot and sRMO and rahulMohindarOscilllatorShortEntry, color=colorSell, style=shape.labeldown, textcolor=#ffffff, text="RMO", location=location.abovebar, transp=0)
// TD
plot(sTD and SR?(TDbuyh ? TDbuyl: na):na,style=circles, linewidth=1, color=red)
plot(sTD and SR?(TDselll ? TDsellh : na):na,style=circles, linewidth=1, color=lime)
barColour = sell? tdSell : buy? tdBuy : sellovershoot? tdSellOvershoot : sellovershoot1? tdSellOvershoot1 : sellovershoot2?tdSellOverShoot2 : sellovershoot3? tdSellOverShoot3 : buyovershoot? tdBuyOverShoot : buyovershoot1? tdBuyOvershoot1 : buyovershoot2? tdBuyOverShoot2 : buyovershoot3? tdBuyOvershoot3 : na
barcolor(color=barColour, title ="TD Sequential Bar Colour")
// ****************************************BUY/SELL Signal ***************************************************************
bull = leledecMajorBullish or bullishPSAR or strongBullishSignal or amaLongConditionEntry or rahulMohindarOscilllatorLongEntry or bullishVFI
bear = leledecMajorBearish or bearishPSAR or strongBearishSignal or amaShortConditionEntry or rahulMohindarOscilllatorShortEntry or bearishVFI
if bull
persistent_bull := 1
persistent_bear := 0
if bear
persistent_bull := 0
persistent_bear := 1
plotshape(bull and persistent_bull[1] != 1, style=shape.labelup, location=location.belowbar, color=colorBuy, text="Buy", textcolor=#000000, transp=0)
plotshape(bear and persistent_bear[1] != 1, style=shape.labeldown, color=colorSell, text="Sell", location=location.abovebar, textcolor =#ffffff, transp=0)
// ****************************************Alerts***************************************************************
// For global buy/sell
alertcondition(bull and persistent_bull[1] != 1, title='Buy', message='Buy')
alertcondition(bear and persistent_bear[1] != 1, title='Sell', message='Sell')
// Strategy
longCondition = leledecMajorBullish or bullishPSAR or strongBullishSignal or amaLongConditionEntry or rahulMohindarOscilllatorLongEntry or bullishVFI
closeLongCondition = leledecMajorBearish or bearishPSAR or strongBearishSignal or amaShortConditionEntry or rahulMohindarOscilllatorShortEntry or bearishVFI
monthfrom =input(1)
monthuntil =input(12)
dayfrom=input(1)
dayuntil=input(31)
yearfrom=input(2017)
yearuntil=input(2020)
leverage=input(1)
if (longCondition )
strategy.entry("Long", strategy.long, leverage, comment="Enter Long")
else
strategy.close("Long", when=closeLongCondition)
//if (closeLongCondition and month>=monthfrom and month <=monthuntil and dayofmonth>=dayfrom and dayofmonth <= dayuntil and year <= yearuntil and year>=yearfrom)
// strategy.entry("Short", strategy.short, leverage, comment="Enter Short")
//else
// strategy.close("Short", when=longCondition)