Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study(title="Ichimoku Cloud", shorttitle="Ichimoku+BB+50EMA+200MA+Fractals", overlay=true)
- showFractal = input(false, "Fractals Off")
- conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
- basePeriods = input(26, minval=1, title="Base Line Periods")
- laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),
- displacement = input(26, minval=1, title="Displacement")
- donchian(len) => avg(lowest(len), highest(len))
- conversionLine = donchian(conversionPeriods)
- baseLine = donchian(basePeriods)
- leadLine1 = avg(conversionLine, baseLine)
- leadLine2 = donchian(laggingSpan2Periods)
- plot(conversionLine, color=#0496ff, title="Conversion Line")
- plot(baseLine, color=#991515, title="Base Line")
- plot(close, offset = -displacement, color=#459915, title="Lagging Span")
- p1 = plot(leadLine1, offset = displacement, color=green,
- title="Lead 1")
- p2 = plot(leadLine2, offset = displacement, color=red,
- title="Lead 2")
- fill(p1, p2, color = leadLine1 > leadLine2 ? green : red)
- //Bill cosby//
- n = input(title="Fractal Periods", defval=2, minval=2, type=integer)
- //down fractal
- dnFractal = (high[n-2] < high[n]) and (high[n-1] < high[n]) and (high[n+1] < high[n]) and (high[n+2] < high[n])
- //up fractal
- upFractal = (low[n-2] > low[n]) and (low[n-1] > low[n]) and (low[n+1] > low[n]) and (low[n+2] > low[n])
- //shapes
- plotshape(showFractal ? na : dnFractal, style=shape.triangledown, location=location.abovebar, offset=-2, color=#008000, transp=0) // Down Triangle above candles
- plotshape(showFractal ? na : upFractal, style=shape.triangleup, location=location.belowbar, offset=-2, color=#000000, transp=0) // Up Triangle below candles
- len = input(200, minval=1, title="Length")
- src = input(close, title="Source")
- out = sma(src, len)
- plot(out, color=blue, title="200MA")
- short = ema(close, 50)
- plot(short, color = orange, title="50EMA")
- source = close
- length = input(20, minval=1), mult = input(2.0, minval=0.001, maxval=50)
- basis = sma(source, length)
- dev = mult * stdev(source, length)
- upper = basis + dev
- lower = basis - dev
- plot(basis, color=red)
- a1 = plot(upper, color=blue)
- a2 = plot(lower, color=blue)
- fill(a1, a2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement