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".

alertcondition() Help

Nov 18, 2021 - 2:19 AM

Viewed 463 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/41177 COPY
  • I have a very noob question that should be easy to resolve. I have added all of the variables used in the plot() function just to give you more context, my question pertains to the plot() function. I want to create an alertcondition() so that whenever this plot() is executed I can set an alert for it, but i dont know how to do it.

    n2 = input(12, Average Length)
    ci = (ap - esa) / (0.015 * d)
    tci = ema(ci, n2)
    wt1 = tci
    wt2 = sma(wt1,3)

    f_top_fractal(_src)=>_src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0]
    f_bot_fractal(_src)=>_src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0]
    f_fractalize(_src)=>f_top_fractal(_src) ? 1 : f_bot_fractal(_src) ? -1 : 0

    WTFractal_topa = f_fractalize(wt2) > 0 and wt2[2] ? wt2[2] : na

    plot(series = WTFractal_topa ? wt2[2] : na, title='Bearish Divergence', color=WTCol2a, linewidth=5, transp=60)

    The plot basically creates a divergence on the wave (a short linear segment) when the conditions are met. This code is from the MC Bee Indicator if you want to see it fully. I dont know how to create the alertcondition() for this can someone please help me!

    div_example.png

    0
  • So far the last thing I tried was adding this code at the end

    bearSignala = false
    bullSignala = false
    bearSignal = false
    bullSignal = false

    if (WTFractal_topa == true)
    bearSignala = true

    if (WTFractal_bota == true)
    bullSignala = true

    if (WTFractal_top == true)
    bearSignal = true

    if (WTFractal_bot == true)
    bullSignal = true

    alertcondition(bearSignala, title='WTFractal_topa TITLE', message='WTFractal_topa MESSAGE')
    alertcondition(bullSignala, title='WTFractal_bota TITLE' , message='WTFractal_bota MESSAGE')
    alertcondition(bearSignal, title='WTFractal_top TITLE', message='WTFractal_top MESSAGE')
    alertcondition(bullSignal, title='WTFractal_bot TITLE', message='WTFractal_bot MESSAGE')

    0
  • Hi

    Looks to me you did it correctly
    What's the issue?

    Dave

    0
  • Dave (@dave):
    Hi
    Looks to me you did it correctly
    What's the issue?
    Dave

    Its not working for some reason, I can choose it in the alert menu and set it up fine, but it never goes off even if i see that divergence play out

    0
  • Dave (@dave):
    Hi
    Looks to me you did it correctly
    What's the issue?
    Dave

    and I use it on a low timeframe (1m) to maximize the amount of instances of this occurring, and visually it does occur yet no alert.

    0
  • Am i not properly defining the correct variable to check for in the alertcondition()?

    0
CONTENTS