OPEN-SOURCE SCRIPT

Buy Sell Badge with ADX by Bybllo

331
Buy Sell Badge with ADX by Bybllo
This indicator generates Buy/Sell badges from a Fast/Slow EMA crossover (the "BSB" signal), then automatically manages an ATR-based stop loss and a risk:reward-based take profit for each signal, showing the resulting entry/stop/target levels directly on the chart along with a live status table.
On top of the EMA-based signal, an optional ADX strength filter can be enabled: when turned on, a badge is only shown if ADX is either at/above an upper threshold or at/below a lower threshold at the time of the signal — i.e. either a strongly trending market or a clearly non-trending one, whichever regime you choose to trade around. Position management (entry, stop loss, take profit, invalidation) always runs on the underlying EMA "BSB" signal regardless of the ADX filter; the filter only controls whether a badge and its risk-management lines are displayed.
Key Features

Fast/Slow EMA crossover generates the base Buy/Sell signal, with an optional candle-confirmation requirement (close beyond open in the signal direction).
Automatic ATR-based stop loss and configurable Risk:Reward take profit are calculated for every new signal, with intermediate take-profit levels plotted when Risk:Reward is greater than 1.
Optional "BSB + ADX" filter: a badge is only shown when ADX is at or above an upper threshold, OR at or below a lower threshold, at the time of the EMA signal — letting you badge-filter for either strong-trend conditions (ADX high) or quiet/ranging conditions (ADX low), while suppressing badges in the ambiguous middle zone.
On-chart entry / stop-loss / take-profit lines and an SL distance (in points) label, both toggleable and only shown while a badge has actually been displayed for the active position.
Take-profit, stop-loss, and "invalidated" (opposite signal fired before target/stop was hit) markers are plotted separately so you can see exactly how each trade idea played out.
A live status table (top-right) shows the current position, entry, stop loss, take profit, and realized Risk:Reward.
Real-price calculation via request.security() keeps signals consistent regardless of chart type (Heikin Ashi, Renko, etc.).
A full set of alertcondition() calls for Buy/Sell signals, take-profit hits, stop-loss hits, and invalidated entries.

How to Use

Leave "BSB + ADX" unchecked to use the EMA crossover badges on their own, with no ADX-based filtering.
Check "BSB + ADX" and set the upper/lower thresholds to only badge signals that occur when ADX confirms your preferred market regime — for example, a high upper threshold badges only strongly trending breakouts, while a low lower threshold badges only signals from quiet, low-ADX conditions.
Watch the on-chart entry/SL/TP lines and the status table to track an open idea's risk and progress in real time.
Set up alerts on the "Buy/Sell Signal", "Entry Signal", "Take Profit Hit", "Stop Loss Hit", or "Entry Invalidated" conditions depending on which events you want to be notified about.

Notes

Unlike a DMI golden-cross / dead-cross confirmation filter, this version filters purely on the ADX strength value itself (above an upper threshold or below a lower threshold), without checking DI+/DI- direction.
Stop-loss and alert-sensitivity offsets are point-based and will need adjusting per instrument (see the tooltips on those inputs).
This indicator does not place real orders; it is a visual / alerting tool for tracking a rules-based EMA (optionally ADX-filtered) trade idea.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.