ScriptingHow toHow to send a webhook when your condition fires

How to send a webhook when your condition fires

Your script cannot address an endpoint. Lipi has no webhook function. What a script does is raise an alert; where that alert goes is configured on the platform, outside the script.

So the work in the script is: fire an alert on the right bar, with the message you want delivered.

alert(series string message) → void
alertcondition(series bool condition, const string title, const string message) → void
indicator("Crossover alert", "xalert", true)

fast = talib.sma(close, 10)
slow = talib.sma(close, 30)
bool fired = talib.crossover(fast, slow)

alertcondition(fired, "Fast crossed above slow", "cross-up")

if fired {
    alert("Fast crossed above slow")
}

plot(fast, title = "Fast", color = color.blue)
plot(slow, title = "Slow", color = color.orange)

Which of the two you want

alertalertcondition
Where you may call itanywhere, including inside a branchtop level only
Messageseries string, may change from bar to barconst string, fixed when the script is compiled
What it doesraises an alert as the script runsdeclares a condition the platform can offer the reader

If the message has to carry a number your script worked out on this bar, you need alert, because only its message is series-form. If you want to hand the reader a named condition and let them set it up, use alertcondition.

If nothing arrives while you are testing

alert fires at most once per bar, only on realtime bars, and only when the script is running as an alert. On historical bars it does nothing, so nothing is raised as the script works through history. That is behaviour, not a fault.

What you cannot do from the script

Address an endpoint, shape a payload, set a retry, authenticate, or place an order. Lipi has no order-placement surface and no strategy construct: what leaves the script is an alert, not an instruction.

See Alerts and Webhooks for algo trading.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade