Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="Zones AIO", overlay=true)
- Fib=input(false,title="Fibs")
- BB=input(false,title="BB")
- candles=input(false)
- mode = input("day")
- hourfix = input(17, title="hourfix(at what time is 00h correct):", minval=0, maxval=23)
- openprice = mode == "hour" ? valuewhen(minute == 0, open, 0) :
- mode == "day" ?
- ( isintraday ? valuewhen(hour == hourfix and minute == 0, open, 0) :
- valuewhen(hour == hourfix, open, 0) ) :
- mode == "week" ?
- ( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, open, 0) :
- valuewhen(dayofweek == 1, open, 0) ) :
- mode == "month" ?
- ( isintraday ? valuewhen(dayofmonth == 1 and hour == hourfix and minute == 0, open, 0) :
- valuewhen(dayofmonth == 1, open, 0) ) :
- mode == "year" ?
- ( isintraday ? valuewhen(weekofyear == 1 and dayofweek == 1 and hour == hourfix and minute == 0, open, 0) :
- isdaily ? valuewhen(weekofyear == 1 and dayofweek == 1, open, 0) :
- valuewhen(weekofyear == 1, open, 0) ) : na
- scolor = openprice != openprice[1] ? na : close >= openprice ? lime : red
- plot(openprice, color=scolor, linewidth=2, transp = 0)
- highprice =( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, security(tickerid,"D" ,high), 0) :
- valuewhen(dayofweek == 1, security(tickerid,"D" ,high), 0) )
- lowprice =( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, security(tickerid,"D" ,low), 0) :
- valuewhen(dayofweek == 1, security(tickerid,"D" ,low), 0) )
- tcolor = highprice != highprice[1] ? na : yellow
- plot(highprice, color=tcolor, linewidth=2, transp = 0)
- plot(lowprice , color=tcolor, linewidth=2, transp = 0)
- //Fibs
- mid=(highprice+lowprice)/2
- mid2=(highprice+mid)/2
- mid3=(mid+lowprice)/2
- plot(Fib?mid:na,color=mid!=mid[1]?na:red)
- plot(Fib?mid2:na,color=mid2!=mid2[1]?na:lime)
- plot(Fib?mid3:na,color=mid3!=mid3[1]?na:lime)
- ///////////////////////////////////////////////////
- length = input(34, minval=2)
- src = input(close, title="Source")
- mult = input(2.0, minval=0.001, maxval=50)
- basis = sma(src, length)
- dev = mult * stdev(src, length)
- upper = basis + dev
- lower = basis - dev
- plot(BB?basis:na, color=aqua)
- p1 = plot(BB?upper:na, color=aqua)
- p2 = plot(BB?lower:na, color=aqua)
- fill(p1, p2)
- //chris moodys days of the week
- disMon = input(true, title="Highlight Monday?")
- disTue = input(true, title="Highlight Tuesday?")
- disWed = input(true, title="Highlight Wednesday?")
- disThur = input(true, title="Highlight Thursday?")
- disFri = input(true, title="Highlight Friday?")
- isMon() => dayofweek(time('D')) == monday and close ? 1 : 0
- isTue() => dayofweek(time('D')) == tuesday and close ? 1 : 0
- isWed() => dayofweek(time('D')) == wednesday and close ? 1 : 0
- isThu() => dayofweek(time('D')) == thursday and close ? 1 : 0
- isFri() => dayofweek(time('D')) == friday and close ? 1 : 0
- barcolor(candles and disMon and isMon() ? (isMon() ? yellow : na) : na)
- barcolor(candles and disTue and isTue() ? (isTue() ? fuchsia : na) : na)
- barcolor(candles and disWed and isWed() ? (isWed() ? lime : na) : na)
- barcolor(candles and disThur and isThu() ? (isThu() ? aqua : na) : na)
- barcolor(candles and disFri and isFri() ? (isFri() ? orange : na) : na)
- Session0Start = input(4)
- Session0End = input(9)
- BGColor0 = iff(hour >= Session0Start and hour <= Session0End, purple, na)
- bgcolor(BGColor0, 80, 0)
- ema1=ema(close,200)
- ema2=ema(close,1200)
- //plot(ema1) //you can delete this line, was for backtesting
- //plot(ema2) //you can delete this line, was for backtesting
- B=close>openprice and crossover(ema1,ema2)
- S=close<openprice and crossunder(ema1,ema2)
- plotchar(B?ema1:na,title="signal",char="X",location=location.absolute,text="BUY",textcolor=white, transp = 0)
- plotchar(S?ema2:na,title="signal",char="X",location=location.absolute,text="SELL",textcolor=white, transp = 0)
- alertcondition(B, title='Alert on Buy', message='MA BUY SIGNAL!')
- alertcondition(S, title='Alert on Sell', message='MA SELL SIGNAL!')
- //EMA 200//
- EMA200len= input(200, minval=1, title="Length")
- EMA200src= input(close, title="Source")
- EMA200=ema(EMA200src, EMA200len)
- plot(EMA200,title='EMA200',transp=0,color=#ffffff,style=line,linewidth =5)
- //EMA 1200//
- EMA1200len= input(1200, minval=1, title="Length")
- EMA1200src= input(close, title="Source")
- EMA1200=ema(EMA1200src, EMA1200len)
- plot(EMA1200,title='EMA1200',color=#0066ff,transp=10,style=line,linewidth =3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement