Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- study(title="Pivot Hilo Support n Resistance Levels R3 by JustUncleL", shorttitle="PVTLVLS R3", overlay=true)
- // By: JustUncleL
- // Date: 20-Mar-2017
- // Version: R3
- //
- // Description:
- // This Pivot Points marked with "star" and with Optional Support and Resistance extension Levels.
- //
- // Options:
- // - Show Pivot Points (default true)
- // - Pivot Length Left Side (default 7), the number of bars left hand side of the Pivot candle.
- // - Pivot Length Right Side (default 7), the number of bars right hand side of the Pivot candle.
- // - Show S/R Extension Levels (default true)
- // - Maximum S/R Extension Length (default 0, no limit)
- // - Show Pivot Labels (instead of "star") "[P.H]" and "[P.L]"
- //
- // Modifications:
- // R3 - added code to force Pivot to be always complete before drawing.
- // R2 - added option for different length test for each side of Pivot.
- // R1 - original.
- //
- // - INPUTS
- ShowPivots = input(true,title="Show Pivot Points")
- pvtLenL = input(7,minval=1,title="Pivot Length Left Hand Side")
- pvtLenR = input(7,minval=1,title="Pivot Length Right Hand Side")
- ShowSRLevels = input(true,title="Show S/R Level Extensions")
- ShowPivotLabels = input(false)
- maxLvlLen = input(0,minval=0, title="Maximum S/R Level Extension Length")
- // - /INPUTS
- // Get High and Low Pivot Points
- pvthi = pivothigh(pvtLenL,pvtLenR)
- pvtlo = pivotlow(pvtLenL,pvtLenR)
- // If Selected Display Pivot points
- plotchar(ShowPivots and not ShowPivotLabels? pvthi[1] :na, title='High Pivot *', location=location.abovebar, color=green, offset=-pvtLenR-1,transp=0,size=size.auto)
- plotchar(ShowPivots and not ShowPivotLabels? pvtlo[1] :na, title='Low Pivot *', location=location.belowbar, color=red, offset=-pvtLenR-1,transp=0,size=size.auto)
- plotshape(ShowPivotLabels? pvthi[1]: na, title='Pivot High Label', style=shape.diamond, location=location.abovebar, color=green, text="[P.H]", offset=-pvtLenR-1,transp=0)
- plotshape(ShowPivotLabels? pvtlo[1]: na, title='Pivot Low Label', style=shape.diamond, location=location.belowbar, color=red, text="[P.L]", offset=-pvtLenR-1,transp=0)
- //Count How many candles for current Pivot Level, If new reset.
- counthi = pvthi[1] ? 0 : nz(counthi[1])+1
- countlo = pvtlo[1] ? 0 : nz(countlo[1])+1
- pvthis = pvthi[1] ? high[pvtLenR+1] : pvthis[1]
- pvtlos = pvtlo[1] ? low[pvtLenR+1] : pvtlos[1]
- hipc = (pvthis != pvthis[1]) ? na : green
- lopc = (pvtlos != pvtlos[1]) ? na : red
- plot(ShowSRLevels and (maxLvlLen==0 or counthi<maxLvlLen)? pvthis : na, color=hipc, transp=0, linewidth=2, offset=-pvtLenR-1, title="Top Levels")
- plot(ShowSRLevels and (maxLvlLen==0 or countlo<maxLvlLen)? pvtlos : na, color=lopc, transp=0, linewidth=2, offset=-pvtLenR-1, title="Bottom Levels")
- //
- //EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement