Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- maxBarsBack = 5000
- study("JM_PPI", overlay = true, max_bars_back = maxBarsBack)
- // ||-------------------------------------------------------------------------||
- // || Pseudo Array ATHs/ATLs: (ID)
- // |{-------------------------------------------------------------------------<•
- // || variable initialization:
- var float ath = 0.0, var float atl = 10e20,
- var line lineH = na, var line lineL = na,
- var line lineLTH = na, var line lineHTL = na,
- var line secondaryH = na, var line secondaryL = na,
- var line secondaryLTH = na, var line secondaryHTL = na,
- var line uptrend = na, var line downtrend = na
- var string Event = "", var string secondaryHigh = ""
- // |{-------------------------------------------------------------------------<•
- ath := max(ath, high)
- atl := min(atl, low)
- // Bars on chart count
- var int BarCount = 0
- BarCount := BarCount + 1
- if change(ath)
- lineH := line.new(time, high, time + (time - time[1]), high, xloc = xloc.bar_time, style = line.style_dotted, extend = extend.both, color = color.red, width = 4)
- lineLTH := line.new(time, low, time + (time - time[1]), low, xloc = xloc.bar_time, style = line.style_dotted, extend = extend.both, color = color.orange, width = 2)
- Event := "Event_ATH"
- if change(atl)
- lineL := line.new(time, low, time + (time - time[1]), low, xloc = xloc.bar_time, style = line.style_dotted, extend = extend.both, color = color.green, width = 4)
- lineHTL := line.new(time, high, time + (time - time[1]), high, xloc = xloc.bar_time, style = line.style_dotted, extend = extend.both, color = color.blue, width = 2)
- Event := "Event_ATL"
- for i = 0 to BarCount - 1
- if (Event == "Event_ATL" and high >= line.get_y1(lineLTH[i]))
- line.delete(lineH[i])
- line.delete(lineLTH[i])
- if (Event == "Event_ATH" and low <= line.get_y1(lineHTL[i]))
- line.delete(lineL[i])
- line.delete(lineHTL[i])
- plot(ath, "ATH", color.red, 4, plot.style_line)
- plot(atl, "ATL", color.lime, 4, plot.style_line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement