Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("ZEEDAN", overlay=true, shorttitle="ZEEDAN ")
- // --- Note on Point & Figure ---
- // The `pointfigure()` function and its related logic from the "London_Underground_V0" script are not available in Pine Script v5 and have been commented out below.
- //=============Hull MA-----------------------------
- show_hma = input.bool(true, title=" Display Centre Band")
- hma_src = input.source(close, title=" Centre Band Source:")
- hma_base_length = input.int(1, minval=1, title=" Centre Band Base Length:")
- hma_length_scalar = input.int(6, minval=0, title=" Centre Band length Scalar:")
- hullma(src, length) =>
- wma1 = ta.wma(src, length / 2)
- wma2 = ta.wma(src, length)
- ta.wma(2 * wma1 - wma2, math.round(math.sqrt(length)))
- plot(not show_hma ? na : hullma(hma_src, hma_base_length + hma_length_scalar * 6), color=color.black, linewidth=4, title="Centre Band")
- //====================channel 1 (ZEEDAN)==========================
- len = input.int(34, minval=1, title=" Length 1")
- src = input.source(close, title=" Source 1")
- out = ta.ema(src, len)
- plot(out, title="EMA 1", color=color.blue, style=plot.style_circles, linewidth=1)
- last8h = ta.highest(close, 13)
- lastl8 = ta.lowest(close, 13)
- plot(last8h, color=color.red, linewidth=2, title=" Upper channel 1")
- plot(lastl8, color=color.green, linewidth=2, title=" Lower channel 1")
- // Signals (calculated but not plotted)
- // Note: close > close is always false, likely intended for identifying bars where a cross happens and the *prior* close was higher/lower.
- bearish = ta.crossunder(close, out) // Simplified to just the cross logic
- bullish = ta.crossover(close, out)
- //======================channel 2 (ZEEDAN)==================================
- len2 = input.int(34, minval=1, title=" Length 2")
- src2 = input.source(close, title=" Source 2")
- out2 = ta.ema(src, len) // Uses 'src' and 'len' from Channel 1 inputs, which matches original v4 code
- plot(out2, title="EMA 2", color=color.maroon, style=plot.style_circles, linewidth=1)
- last8h2 = ta.highest(close, 34)
- lastl82 = ta.lowest(close, 34)
- plot(last8h2, color=color.black, style=plot.style_line, linewidth=1, title=" Upper channel 2")
- plot(lastl82, color=color.black, style=plot.style_line, linewidth=1, title=" Lower channel 2")
- bearish2 = ta.crossunder(close, out)
- bullish2 = ta.crossover(close, out)
- //======================Pivot Channel (ZEEDAN)==================================
- length1 = input.int(13, minval=1, title=" Pivot Channel upper length")
- length2 = input.int(13, minval=1, title=" Pivot Channel lower length")
- // Fix: highest/lowest needs a source series and a length integer.
- upper = ta.highest(high, length1)
- lower = ta.lowest(low, length2)
- basis = math.avg(upper, lower)
- l = plot(lower, style=plot.style_circles, linewidth=2, color=color.green, title="Pivott Channel lower")
- u = plot(upper, style=plot.style_circles, linewidth=2, color=color.red, title="Pivott Channel upper")
- fill(u, l, color=color.new(color.black, 100), title="Fill Channel")
- //========={RS} spike hunter (ZEEDAN)================================================================================//
- // Note: 'n' variable was redefined as 'bar_index' for V5 compliance.
- n = bar_index < 4000 ? bar_index : 4000
- tr = ta.tr(true)
- _atr = math.sum(tr, n + 1) / (n + 1)
- top = (high - math.max(close, open)) > tr * 0.5 and tr > _atr
- bot = (math.min(close, open) - low) > tr * 0.5 and tr > _atr
- plotchar(top, color=color.blue, text="", title="Top Spike")
- plotchar(bot, location=location.belowbar, color=color.blue, text="", title="Bottom Spike")
- //------Moddified [RS]Fractals V2 (ZEEDAN)
- length_f = input.int(22, title=" Fractal Length")
- filterFractals = input.bool(true, title=" Signal filter")
- // Original V4 logic translated to V5 syntax.
- ftop = high[2] > high[3] and high[2] > high[4] and high[2] > high[1] and high[2] > high[0]
- fbot = low[2] < low[3] and low[2] < low[4] and low[2] < low[1] and low[1] < low[0]
- topf = ftop and high[2] >= ta.highest(high, length_f)
- botf = fbot and low[2] <= ta.lowest(low, length_f)
- filteredtopf = filterFractals ? topf : ftop
- filteredbotf = filterFractals ? botf : fbot
- plotshape(filteredtopf, style=shape.triangledown, location=location.abovebar, color=color.gray, text="..........", offset=-2, title="Filtered Top Fractal")
- plotshape(filteredbotf, style=shape.triangleup, location=location.belowbar, color=color.gray, text="..........", offset=-2, title="Filtered Bottom Fractal")
- //================================================================================//
- // START OF London_Underground_V0 SCRIPT LOGIC
- //================================================================================//
- len_lu = input.int(21, minval=1, title="[LU] Length")
- src_lu = input.source(close, title="[LU] Source")
- out_lu = ta.ema(src_lu, len_lu)
- plot(out_lu, title="[LU] EMA", color=color.blue)
- last8h_lu = ta.highest(close, 13)
- lastl8_lu = ta.lowest(close, 13)
- plot(last8h_lu, color=color.black, style=plot.style_line, linewidth=3, title="[LU] Upper channel")
- plot(lastl8_lu, color=color.black, style=plot.style_line, linewidth=3, title="[LU] Lower channel")
- bearish_lu = ta.crossunder(close, out_lu)
- bullish_lu = ta.crossover(close, out_lu)
- //======{RS} Point and Figure (Removed due to v5 incompatibility) =======================================================//
- // These inputs remain in the script, but the logic using them is commented out as the 'pointfigure' function is gone in V5.
- tf = input.timeframe('240', title="[LU] P&F Timeframe")
- M = input.string('ATR', title="[LU] P&F Method")
- P = input.float(14.00, title="[LU] P&F P")
- W = input.int(1, title="[LU] P&F W")
- // pf = pointfigure(syminfo.tickerid, 'close', M, P, W) // Function not available in v5
- // spfc = request.security(pf, tf, close)
- // p2 = plot(spfc, color=color.red, linewidth=4, title="[LU] Central Line (P&F - Disabled)")
- //============================Ichomku (London Underground)---------------------------------------------//
- show_cloud_lu = input.bool(true, title="[LU] Display Ichimoku Cloud:")
- // Renamed input variables to avoid conflicts with function arguments
- conversionPeriods_lu = input.int(34, minval=1, title="[LU] Conversion Periods")
- basePeriods_lu = input.int(26, minval=1, title="[LU] Base Periods")
- laggingSpan2Periods_lu = input.int(52, minval=1, title="[LU] Lagging Span 2 Periods")
- displacement_lu = input.int(26, minval=1, title="[LU] Displacement")
- donchian_lu(len) => math.avg(ta.lowest(len), ta.highest(len))
- conversionLine = donchian_lu(conversionPeriods_lu)
- baseLine = donchian_lu(basePeriods_lu)
- leadLine1 = math.avg(conversionLine, baseLine)
- leadLine2 = donchian_lu(laggingSpan2Periods_lu)
- plot(not show_cloud_lu ? na : conversionLine, color=color.green, linewidth=3, style=plot.style_line, title="[LU] Mid line resistance levels")
- plot(baseLine, color=color.maroon, linewidth=4, title="[LU] Base Line")
- p1_lu = plot(not show_cloud_lu ? na : leadLine1, offset = displacement_lu, color=color.white, linewidth=1, title="[LU] Lead 1")
- p3_lu = plot(not show_cloud_lu ? na : leadLine2, offset = displacement_lu, color=color.blue, linewidth=4, title="[LU] Lead 2")
- fill(p1_lu, p3_lu, color=color.new(color.blue, 100))
- //----------------------------------------------------------------------------////
Advertisement
Add Comment
Please, Sign In to add comment