OPEN-SOURCE SCRIPT
Webhook Alert Strategy Template

Educational strategy shell that builds webhook-ready alert messages from strategy order fills.
Why this exists
Most traders can write an entry condition. The hard part is packaging a clean, risk-defined exit and a stable alert string that an external webhook receiver can parse. This template is a starting shell for that workflow.
What it does
- Demo entry: MA crossover (EMA/SMA/WMA/RMA selectable). Replace this with your own logic.
- Risk exits: ATR-based stop distance (or fixed pip distance), take-profit from risk:reward.
- Alert messages: attaches comma-separated command strings to strategy entries and exits using alert_message.
Message format examples
BUY,XAUUSD,VOL=0.01,SL=120.5,TP=241,TPSLTYPE=PIPS
SELL,XAUUSD,VOL=0.01,SL=120.5,TP=241,TPSLTYPE=PIPS
CLOSE,XAUUSD
How to use
1. Add the strategy to a standard chart (gold/forex/indices work well).
2. Set VOL, ATR stop, and RR in inputs.
3. Create one alert on this strategy.
4. Choose order fills and alert() function calls.
5. Set the alert message field to exactly: {{strategy.order.alert_message}}
6. Enable webhook URL notifications and paste your own webhook endpoint.
What this is not
This is not a signal service and not financial advice. Default MA entry is only a placeholder so the shell compiles and can be tested. Backtest results with the demo entry are not a performance claim.
Originality
The useful part is the combination of risk-defined strategy exits plus explicit webhook command string generation on fills, so users can learn alert_message plumbing without rebuilding exits from scratch.
Defaults used for this publication
- Symbol: XAUUSD (OANDA)
- Timeframe: 1D
- Initial capital: 10000
- Position size: 2% of equity
- Commission: 0.02%
- Slippage: 2 ticks
Why this exists
Most traders can write an entry condition. The hard part is packaging a clean, risk-defined exit and a stable alert string that an external webhook receiver can parse. This template is a starting shell for that workflow.
What it does
- Demo entry: MA crossover (EMA/SMA/WMA/RMA selectable). Replace this with your own logic.
- Risk exits: ATR-based stop distance (or fixed pip distance), take-profit from risk:reward.
- Alert messages: attaches comma-separated command strings to strategy entries and exits using alert_message.
Message format examples
BUY,XAUUSD,VOL=0.01,SL=120.5,TP=241,TPSLTYPE=PIPS
SELL,XAUUSD,VOL=0.01,SL=120.5,TP=241,TPSLTYPE=PIPS
CLOSE,XAUUSD
How to use
1. Add the strategy to a standard chart (gold/forex/indices work well).
2. Set VOL, ATR stop, and RR in inputs.
3. Create one alert on this strategy.
4. Choose order fills and alert() function calls.
5. Set the alert message field to exactly: {{strategy.order.alert_message}}
6. Enable webhook URL notifications and paste your own webhook endpoint.
What this is not
This is not a signal service and not financial advice. Default MA entry is only a placeholder so the shell compiles and can be tested. Backtest results with the demo entry are not a performance claim.
Originality
The useful part is the combination of risk-defined strategy exits plus explicit webhook command string generation on fills, so users can learn alert_message plumbing without rebuilding exits from scratch.
Defaults used for this publication
- Symbol: XAUUSD (OANDA)
- Timeframe: 1D
- Initial capital: 10000
- Position size: 2% of equity
- Commission: 0.02%
- Slippage: 2 ticks
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.