1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
33 lines of Pine Script v6 from tradingview_test.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
tradingview_test.pine
//#region ===== INFO ===================================================================================================
// Webhook Test Script for TradingView
// This script creates test alerts for webhook integration with your trading bot
// It will generate alerts for long/short open/close positions on the current bar
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Developed by Ilkay Beydah Saglam https://beydahsaglam.com
//@version=6
indicator(
"🔥 Webhook Test 🔥",
overlay = true,
max_labels_count = 100,
calc_bars_count = 100,
dynamic_requests = true
)
//#endregion
//#region ===== TEST ===================================================================================================
// Alert Conditions - These will trigger webhook calls to your bot
// Each alert sends a JSON payload with symbol, alert type, price, and API key
// The webhook URL and authentication are configured in the TradingView alert settings
// Test each alert type individually to verify proper integration with your trading bot
// Replace 'YOUR_BOT_HOOK_KEY' with your actual API key before using
bool test = barstate.islast
alertcondition(test, title='Long Open', message='{"symbol": "{{ticker}}", "alert": "long_open", "price": "{{close}}", "key": "YOUR_BOT_HOOK_KEY"}')
alertcondition(test, title='Long Close', message='{"symbol": "{{ticker}}", "alert": "long_close", "price": "{{close}}", "key": "YOUR_BOT_HOOK_KEY"}')
alertcondition(test, title='Short Open', message='{"symbol": "{{ticker}}", "alert": "short_open", "price": "{{close}}", "key": "YOUR_BOT_HOOK_KEY"}')
alertcondition(test, title='Short Close', message='{"symbol": "{{ticker}}", "alert": "short_close", "price": "{{close}}", "key": "YOUR_BOT_HOOK_KEY"}')
//#endregion
Overview
Webhook Test evaluates conditions on the latest price bar to trigger simulated open long, close long, open short, and close short alerts. Each alert condition formats a structured JSON payload containing ticker, alert type, close price, and API key placeholders. It runs directly on the main price chart.
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive Laguerre Filter calculates a smoothed, dynamically adjusted trendline plotted directly on the main price chart. It dynamically adjusts its damping factor (alpha) based on recent price range variations and median percentile calculations over a spec
The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
1833 Tracker is an overlay indicator that visualizes historical buy and sell transactions executed by ARK Invest ETFs for the stock on the main price chart. It displays trade dates using green buy and red sell labels positioned relative to price bars, indicati