Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Author hajixde
- // This indicator finds the High/Low swinging index
- //@version=4
- study(title = "Hi/Lo Swing Index", overlay = false, format=format.price, precision=2, resolution="")
- maLen = input(10, title = "MA Length")
- maLen2 = input(7, title = "Smoothing Length")
- histLen = input(200, title = "Memory Length")
- showTrend = input(true, title = "Show Trend Direction ?")
- hlDiff = high - low
- hlRatio = hl2 / hlDiff
- hlRatioMa = ema(hlRatio, maLen)
- hlRatioNormalized = 100 *((hlRatioMa - lowest(hlRatioMa,histLen)) / (highest(hlRatioMa, histLen) - lowest(hlRatioMa, histLen)))
- hlRatioNormalizedSmoothed = wma(hlRatioNormalized, maLen2)
- plot(hlRatioNormalized, color = color.blue)
- plot(showTrend ? hlRatioNormalizedSmoothed : na, color = hlRatioNormalizedSmoothed > hlRatioNormalizedSmoothed[1] ? color.green : color.red, linewidth = 2)
- plot(not showTrend ? hlRatioNormalizedSmoothed : na, color = color.red, linewidth = 1)
- l1 = hline(0)
- l2 = hline(20)
- l3 = hline(80)
- l4 = hline(100)
- fill(l2, l3, color = color.blue)
- fill(l1, l2, color = color.red)
- fill(l3, l4, color = color.red)
Advertisement
Add Comment
Please, Sign In to add comment