Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- //
- study(title="Price Action HiLo Channel Alert R1 by JustUncleL",overlay = true, shorttitle="PACALERT R1")
- //
- //Created By: JustUncleL on 3 Jan 2017
- //Version: R1
- //
- //Description:
- // This is an implementation of a Price Action Channel HiLo Alert indicator.
- //
- //Notes:
- //
- //Modifications:
- //
- // reference:
- //
- ShowPAC = input(false)
- lenLo = input(10, minval=2, title="Low Channel Length")
- lenHi = input(10, minval=2, title="High Channel Length")
- lenMe = input(10, minval=1, title="Median Channel Length")
- bars_on = input(false,title="Color Code Bars")
- //
- ShowEMA = input(false)
- filterE = input(false,title="Use Directional Filter")
- dLength = input(200,minval=2,title="Directional EMA length")
- dCandles= input(3,minval=2,title="Direction test Candles")
- //
- DodgerBlue = #1E90FF
- //
- // --- SOURCES ---
- close_ = security(ticker, period, close)
- open_ = security(ticker, period, open)
- high_ = security(ticker, period, high)
- low_ = security(ticker, period, low)
- hl2_ = security(ticker, period, hl2)
- //
- emaD = ema(close_,dLength)
- plot(ShowEMA?emaD:na,color=blue,transp=0,title="Slow EMA trend line", linewidth=2)
- // Calculate and draw the Price Action channel
- pacLo = ema(low_,lenLo)
- pacHi = ema(high_,lenHi)
- pacMe = ema(close_,lenMe)
- plot(ShowPAC?pacLo:na,title="Low Price Line",style=line,color=gray,transp=0,linewidth=2)
- plot(ShowPAC?pacHi:na,title="High Price Line",style=line,color=gray,transp=0,linewidth=2)
- plot(ShowPAC?pacMe:na,title="Median Price Line",style=line,color=orange,transp=0,linewidth=2)
- // Calculate CCI indicating continuance of trend.
- isup = close>open and close>pacHi and close[1]<pacHi[1]
- isdown = close<open and close<pacLo and close[1]>pacLo[1]
- barcolor(bars_on ? isup ? aqua : isdown ? black : na : na )
- // Check have alert and use MACD filter
- up_alert = isup and (not filterE or (pacMe>emaD and rising(emaD,dCandles))) ? na(up_alert[1]) ? 1 : up_alert[1]+1 : 0
- dn_alert = isdown and (not filterE or (pacMe<emaD and falling(emaD,dCandles))) ? na(dn_alert[1]) ? 1 : dn_alert[1]+1 : 0
- //
- plotarrow(up_alert==1? 0.1 : dn_alert==1? -0.1 : na, colorup=aqua, colordown=black, transp=20,minheight=10,maxheight=100, title="PAC Alert Arrows")
- // generate an alert if required.
- alertcondition(up_alert==1 or dn_alert==1, title="PACALERT", message="PACALERT")
- //EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement