OPEN-SOURCE SCRIPT

Supertrend X2 + Calc

292
Size Calculator:
Size Calculator is a risk management tool that helps traders position themselves intelligently by calculating optimal position size, stop loss, and take profit levels based on account capital, ATR volatility, and personal risk tolerance. It takes the guesswork out of sizing so you can focus on execution.

Features:

✅ Risk-based position sizing

✅ ATR-based stop loss & take profit levels

✅ Dynamic leverage estimation

✅ Support for long and short positions

✅ Visual display of key levels and metrics via table

✅ Works across any timeframe with locked timeframe support

How It Works:
This tool computes the ideal position size as a % of account capital based on how much you're willing to risk per trade and how far your stop loss is (in ATR units). It calculates corresponding stop loss and take profit prices, and visually plots them along with a floating table of metrics. You can lock the timeframe used for ATR and price, keeping your risk logic stable even when changing chart views.

Customizable Inputs:

Account capital and risk tolerance

ATR-based stop loss & take profit multiples

Trade direction (Long or Short)

ATR period and locked timeframe

Optional detailed metrics display

Dual SuperTrend:
The Dual Supertrend indicator enhances the classic Supertrend strategy by layering two customizable Supertrend signals with independent ATR settings. This setup gives you a deeper, more nuanced read on trend strength and potential entry zones.

Features:

✅ Two Supertrend lines (each with adjustable ATR periods and multipliers)

✅ Optional Heikin Ashi candle smoothing for noise reduction

✅ Color-coded trend background for fast visual analysis

✅ Multi-timeframe trend table overlay (customizable)

✅ Built-in signal logic to identify "Long", "Short", or "N/A" zones

✅ Built-in alerts from Long and Short Entry Zones

How It Works:
The script calculates two Supertrend levels using separate ATR settings. Trend direction is derived from the relationship between price and each band. When the larger (slower) Supertrend flips and the smaller (faster) confirms, it signals a potential entry. The multi-timeframe table helps you align trades across different timeframes.

Customizable Inputs:

ATR Periods & Multipliers for both Supertrends

Timeframes for entry zone detection (up to 4)

Enable/disable Heikin Ashi candles for smoother trend detection

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.