Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

  • Forums
  • Pinescript
  • Create Alert when 'show_miss', Skull label, get's plotted in this script (pivot points high low & missed reversal (luxalgo)

Create Alert when 'show_miss', Skull label, get's plotted in this script (pivot points high low & missed reversal (luxalgo)

Jan 10, 2023 - 1:22 PM

Viewed 1934 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/1573839 COPY
  • I hope it's ok to post this question to this forum. I'm trying to figure out how to get an Alert, or signal, created when the 'show_miss' condition is met, which plots the ghost/skull label to the chart in this script from TradingView.
    (https://www.tradingview.com/script/OxJJqZiN-Pivot-Points-High-Low-Missed-Reversal-Levels-LUX/)

    With ph and pl, I have no problems to add an Alertcondition to the script, firing an alert when the regular pivot high/lows are plotted.

    Is it possible to create Alerts, or signals, together with the 'show_miss' label?

    Many thanks!

    Screen Shot 2023-01-10 at 12.23.14 PM.png

    0
  • Yes you have to add the alert() function

    var label lbl = na
    if barstate.islast
        x = 0,y = 0.
    
        prices = array.new_float(0)
        prices_x = array.new_int(0)
    
        for i = 0 to n-px1-1
            array.push(prices,os==1?low[i]:high[i])
            array.push(prices_x,n-i)
    
        label.delete(lbl[1])
    
        if os == 1
            y := array.min(prices)
            x := array.get(prices_x,array.indexof(prices,y))
    
            if show_miss
                lbl := label.new(x,y,'👻',color=miss_pl_css,style=label.style_label_up,size=size.small,
                  tooltip=str.tostring(y,'#.####'))
              alert("Green Skull", alert.once_per_bar_close)
        else
            y := array.max(prices)
            x := array.get(prices_x,array.indexof(prices,y))
    
            if show_miss
                lbl := label.new(x,y,'👻',color=miss_ph_css,style=label.style_label_down,size=size.small,
                  tooltip=str.tostring(y,'#.####'))
                  alert("Red Skull", alert.once_per_bar_close)
        if show_miss
            line.delete(line.new(px1,py1,x,y,color=os == 1 ? miss_ph_css : miss_pl_css,style=line.style_dashed)[1])
    
        line.delete(line.new(x,y,n,y,color = color.new(os == 1 ? miss_ph_css : miss_pl_css,50),width=2)[1])
    
    0
CONTENTS