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

How to set 2 seperate alerts?

Apr 12, 2022 - 1:49 PM

Viewed 814 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/56327 COPY
  • Hello i have tryied to do my first own script, after 3 days i need help, i need 2 seperate alerts in one ticker on tradingview to send to 3comma, i have definied evererything but its stil not working

    //@version=2
    strategy(T8X, overlay=true)

    ema10 = ema(close, 1)
    sma18 = sma(close, 88)

    plot(ema10, title=10, color=green, linewidth=2)
    plot(sma18, title=18, color=red, linewidth=2)

    message_long_entery = input(long entery message)
    long = crossunder(ema10, sma18)
    alertcondition(long, Buy, message=message_long_entery)

    message_long_exit = input(long exit message)
    out = crossunder(ema1, sma88)
    alertcondition(out, Sell, message=message_long_exit)

    if(long)

    strategy.entry(Long, strategy.long)

    if(out)
    strategy.close_all(when = out)

    0
  • alertcondition isn't compatible with strategy scripts

    You'll have to use the alert_message parameter of the strategy.entry function
    Documentation: https://www.tradingview.com/pine-script-reference/v5/#fun_strategy{dot}entry

    0
CONTENTS