Search code examples
pine-scriptalertwebhookstradingview-apipine-script-v4

Problem with getting alerts from the TradingView strategy


I want to modernize the TradingView strategy code to send alerts Open Long and Open Short to a specific WebHook address with a Once Per Bar Close trigger. But I encountered a problem.

When I use "comment" in "strategy.entry" and in the alert box I write {{strategy.order.alert_message}}, I get an ID message.

When I type "alert_message", an error pops up when I try to compile the code:

Unknown argument `alert_message`;
Cannot call `strategy.entry` with arguments (literal__string, bool, literal__string, string); available overloads: strategy.entry(literal__string, series__bool, series, series, series, string, literal__string, string, series__bool) => void

Code of a strategy: https://pastebin.com/4SeQj3Sg


Solution

  • alert_message has been introduced in v4 so you should upgrade your code.

    This is the signature in v3:

    strategy.entry(id, long, qty, limit, stop, oca_name, oca_type, comment, when) → void
    

    You can use this guideline.