Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- //
- // @author LazyBear
- // If you use this code in its original/modified form, do drop me a note.
- //
- // Revisions:
- // R1: Original - LazyBear.
- // R2: by pythagoras
- // - Added Time scaling factor.
- // - Colored Overbought and oversold zones.
- // - Added extreme OS and OB indication (cross)
- // - Plus other changes
- // R3: by JustUncleL
- // - Added inner levels for wtdiff analysis
- // - Added highlighting of wtdiff crossing into centre channel
- //
- //
- study(title="Fractal Resonance Component R3 revised by JustUncleL", shorttitle="FR_COMPONENT R3")
- stratMultiplier = input(defval = 1, title = "Timescale Multiplier")
- n1 = input(19, "Channel Length")
- n2 = input(17, "Stochastic Ratio Filter")
- crossover_sma_len = input(11, "Crossover Lag (>1)")
- obLevel = input(75, "Overbought %")
- osLevel = -obLevel
- obExtremeLevel = input(100, "Extreme Overbought %")
- osExtremeLevel = -obExtremeLevel
- // === R3
- obinnerLevel = input(20, "Inner Level %")
- osinnerLevel = -obinnerLevel
- // === /R3
- waveTrend( ap, n_channel, n_average, timeMultiplier ) =>
- esa = ema(ap, n_channel*timeMultiplier)
- d = ema(abs(ap - esa), n_channel*timeMultiplier)
- ci = 100*(ap - esa) / d
- tci = ema(ci, n_average*timeMultiplier)
- wtA= tci
- wtB = sma(wtA,crossover_sma_len*timeMultiplier)
- wtDiff = wtA-wtB
- [wtA, wtB, wtDiff]
- [wta, wtb, wtdiff] = waveTrend( hlc3 , n1, n2, stratMultiplier )
- obE = hline(obExtremeLevel, color=white, linestyle=dashed, linewidth=1)
- ob = hline(obLevel, color=white, linestyle=dotted, linewidth=1)
- fill(ob, obE, color=maroon, transp=90)
- os = hline(osLevel, color=white, linestyle=dotted, linewidth=1)
- osE = hline(osExtremeLevel, color=white, linestyle=dashed, linewidth=1)
- fill(os, osE, color=olive, transp=90)
- // === R3
- obi = hline(obinnerLevel, color=black, linestyle=line, linewidth=1)
- osi = hline(osinnerLevel, color=black, linestyle=line, linewidth=1)
- plot(crossunder(wtdiff, obinnerLevel) ? wtdiff : na, color = red , style = circles, linewidth = 4)
- plot(crossover(wtdiff, osinnerLevel) ? wtdiff : na, color = green , style = circles, linewidth = 4)
- // === /R3
- plot(wtdiff, color=blue, style=area, transp=80)
- plot( wta, color=green)
- plot( wtb, color=red)
- extreme_cross = (wta > obExtremeLevel or wta < osExtremeLevel) and cross(wta, wtb)
- significant_cross = (wta > obLevel or wta < osLevel) and cross(wta, wtb)
- plot(significant_cross ? wta : na, color = black , style = circles, linewidth = 3)
- plot(extreme_cross ? wta : na, color = black , style = cross, linewidth = 3)
- cross_circle_color = (wtb - wta > 0) ? red : lime
- //cross_circle_color = at_extremes ? (wtb - wta > 0 ? red : lime) : (wtb - wta > 0 ? #FF9900 : aqua)
- plot(cross(wta, wtb) ? wtb : na, color = cross_circle_color , style = circles, linewidth = 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement