OPEN-SOURCE SCRIPT

[codapro] Confirmed Supertrend Flags

2 277
snapshot

[codapro] Confirmed Supertrend Flags — Delayed Flip Confirmation

Description:

This script enhances the classic Supertrend by adding a confirmation delay after trend flips, helping traders filter noise and avoid premature entries in volatile environments.

Key Features:

ATR-based Supertrend stop level calculation

Confirmation logic: buy/sell flags appear only after N full bars confirm the new direction

Optional Supertrend stop line for visual tracking

Fully adjustable flag size, color, label, and placement

This is ideal for swing traders, trend followers, or anyone building a system that prefers confirmation over early guessing.

How It Works:

A trend flip is detected when price closes beyond the Supertrend stop level.

The indicator waits for a set number of bars to close in the new direction.

After confirmation, a visual flag is plotted: buy below bar, short above bar.

How to Extend with Risk Management:

While this script focuses on trend confirmation visualization, you can enhance your decision-making by combining it with risk rules:

Stop Loss: Set SL just beyond the last Supertrend level before confirmation

ATR-Based Sizing: Use the same ATR value to dynamically size your position based on volatility

Fixed % Rule: Risk a fixed % of capital per confirmed flip (e.g., 1–2%)

Time-Based Exit: Exit trades that don’t follow through within N bars post confirmation

Stack with Strategy: Use this confirmation logic to trigger entries in a separate strategy script where strategy.entry() and strategy.exit() can be defined with precise risk parameters

Want a full example of how to integrate that? Let me know and I’ll turn this into a plug-and-play strategy version.

Disclaimer:
This tool was developed as part of the codapro AI engine — a modular signal and automation layer for trading systems.
It is for educational and informational purposes only and is not financial advice. Always backtest and verify before live deployment.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.