Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Standard Deviation from Open Price //
- study(title="StdDev", shorttitle="StdDev", overlay = true )
- Length = input(defval = 288, title="Lookback Period........................................................ *Note: Standard Deviation tends to increase commensurate to lookback period*")
- Basis = input(type=source, defval=open, title="Source")
- sd1 = input(1 , title="X Standard Deviation (Default 1)")
- sd2 = input(2 , title="X Standard Deviation (Default 2)")
- sd3 = input(3 , title="X Standard Deviation (Default 3)")
- // Standard Deviation will fall on a bell curve with .5 of it on the right of the mean and .5 of it on the left of mean
- // That's what these do
- ssd1 = sd1 / 2
- ssd2 = sd2 / 2
- ssd3 = sd3 / 2
- sd = stdev(Basis, Length)
- z1 = Basis + (ssd3 * sd)
- z2 = Basis + (ssd2 * sd)
- z3 = Basis + (ssd1 * sd)
- z4 = Basis - (ssd1 * sd)
- z5 = Basis - (ssd2 * sd)
- z6 = Basis - (ssd3 * sd)
- // SD plot//
- plot(z1, linewidth=2, style=circles, color=green, offset=0, title="+3 sd")
- plot(z2, linewidth=2, style=circles, color=blue, offset=0, title="+2 sd")
- plot(z3, linewidth=2, style=circles, color=red, offset=0, join=true, title="+1 sd")
- plot(z4, linewidth=2, style=circles, color=red, offset=0, join=true, title="-1 sd")
- plot(z5, linewidth=2, style=circles, color=blue, offset=0, title="-2 sd")
- plot(z6, linewidth=2, style=circles, color=green, offset=0, title="-3 sd")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement