Pine Script is TradingView’s programming language for creating custom indicators, strategies, and alerts. It allows you to automate trading signals, analyse data, and visualise custom calculations directly on charts. This makes it a practical tool for traders who want to define their own entry and exit logic. Write or paste code in the Pine Editor and apply it to your chart. You can also set up custom alerts based on your script's conditions. Once the alert is active, TradingView monitors the chart in real time and sends you notifications when the conditions defined in your script are met.
What is Pine Script?
Pine Script is a programming language purpose-built for creating custom indicators, strategies, and alerts on TradingView. The language allows traders to automate trading signals, analyse data, and visualise custom calculations directly on charts. Pine Script runs server-side on TradingView’s infrastructure, so scripts execute without requiring any local software installation or configuration.
The language is designed to be accessible to traders who may not have deep programming experience. Pine Script uses a concise syntax that focuses on price data manipulation, making common tasks – such as calculating a moving average crossover or plotting support and resistance levels – achievable in just a few lines of code. TradingView maintains extensive documentation and a public script library where community members share indicators and strategies, providing a starting point for traders building their first scripts.
Pine Script supports two main script types: indicators and strategies. Indicators overlay visual elements on charts, such as lines, labels, or shaded regions. Strategies simulate order execution against historical data, enabling backtesting to evaluate how a trading approach would have performed in past market conditions. Both script types can define alert conditions that trigger automated notifications.
Understanding how Pine Script fits into the TradingView ecosystem is the first step toward building custom signals that align with your trading approach on BitMEX.
How do I create and apply a Pine Script signal?
Creating a trading signal with Pine Script involves writing or importing a script, applying it to your chart, and then configuring an alert that fires when specific conditions are met. The entire workflow takes place within the TradingView interface.
Follow these steps to build and activate a trading signal:
- Open TradingView and select your trading pair – choose a BitMEX instrument from the symbol search so the script runs against the correct price data.
- Create and apply your script:
- Open the Pine Editor at the bottom of the chart.
- Write or paste your Pine Script code (e.g. a custom indicator or strategy that defines buy and sell conditions).
- Click Save to store your script, then click Add to Chart to apply it. The script’s visual output and alert conditions become active on the selected instrument.
- Set up an alert based on your script:
- Click the Alert button in the top toolbar.
- In the Condition dropdown, select the custom script you just applied.
- Choose the appropriate AlertCondition from the script (e.g. buy or sell signals).
- Customise the alert settings, including frequency and notification method (push, email, SMS, or Webhook), then click Create.
Once the alert is active, TradingView monitors the chart in real time and sends you notifications when the conditions defined in your script are met. Webhook alerts are particularly useful for traders who want to connect signals to external automation tools or logging systems. You can manage, edit, or delete active alerts from the Alerts panel at any time.