DigitalGeek
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: September 7th, 2022
Contact: TradingView Profile

This Indicator (Semafor) alert does not work

Hello the community , im using this indicator as "confirmation" in my trading setup
however , this script does not generate alert even it is coded
could you please help me to fix it please ?
thanks a lot!

alertcondition(switch, "Semafor Alert", "New Semafor Level Confirmed")

Code: Select all

////////
// Preheat Oven
// [
study("Semafor", overlay=true, max_labels_count=300)
// ]

////////
// Bake Water With Vinegar For 20 Minutes
// [
repaint = input(false, "Allow Drawing Of Unconfirmed Levels")
zigzag(Depth, Deviation, Color, Size, Type) =>
    var lw = 1, var hg = 1
    lw := lw + 1, hg := hg + 1
    p_lw = -lowestbars(Depth), p_hg = -highestbars(Depth)
    lowing = lw == p_lw or low - low[p_lw] > Deviation*syminfo.mintick
    highing = hg == p_hg or high[p_hg] - high > Deviation*syminfo.mintick
    lh = barssince(not highing), ll = barssince(not lowing)
    down = lh > ll, lower = low[lw] > low[p_lw], higher = high[hg] < high[p_hg]
    if lw != p_lw and (not down[1] or lower)
        lw := p_lw < hg ? p_lw : 0
    if hg != p_hg and (down[1] or higher)
        hg := p_hg < lw ? p_hg : 0
    x1 = down ? lw : hg
    y1 = down ? low[lw] : high[hg]
    lb = down ? label.style_label_up : label.style_label_down
    label point = na
    if repaint
        point := label.new(bar_index-x1, y1, color=Color, style=label.style_circle, size=Size)
        if down == down[1]
            label.delete(point[1])
    if not repaint and down != down[1]
        nx = down ? hg : lw
        point := label.new(bar_index-nx, down ? high[nx] : low[nx], color=Color, style=label.style_circle, size=Size)
    down != down[1]
// ]


////////
// Serve While Hot
// [
switch = false
if input(true, "Large")
    switch := zigzag(input(150, "Depth"), input(24.0, "Deviation"), input(color.red, "Color"), size.normal, "Large") or switch
if input(true, "Medium")
    switch := zigzag(input(34, "Depth"), input(6.0, "Deviation"), input(color.orange, "Color"), size.small, "Medium") or switch
if input(false, "Small")
    switch := zigzag(input(14, "Depth"), input(3.0, "Deviation"), input(color.lime, "Color"), size.tiny, "Small") or switch
// ]

////////
// Monchoka Juu Unajinauwo
// [
alertcondition(switch, "Semafor Alert", "New Semafor Level Confirmed")
// ]

Return to “Pine Script Q&A”