OPEN-SOURCE SCRIPT

Adaptive Trend & SL System

159
Adaptive Trend & Risk System [ATS]

1. The Problem: "Naked" Signals
Most trend indicators on TradingView have a fatal flaw: they tell you when to enter, but they never tell you when to leave. They give you a "Buy" signal, but leave you guessing about where to place your Stop Loss or where to take profit.

A signal without a risk management plan is not a strategy—it's a gamble.

2. The Solution: A Complete Trading System
The Adaptive Trend & Risk System (ATS) is designed to be a complete "Turnkey" trading suite. It doesn't just generate signals; it manages the entire lifecycle of the trade.

It combines three distinct market concepts into one clean overlay:
  • Trend Detection: Uses a Hull Moving Average (HMA) baseline to determine the immediate market flow.
  • Signal Filtering: Uses the Average Directional Index (ADX) to filter out "fakeouts" and weak trends.
  • Dynamic Risk Management: Automatically calculates Volatility-Based (ATR) Stop Losses and Risk:Reward targets the moment a signal is generated.


3. How It Works (The Math)
The script operates on a strict "State Machine" logic. It remembers the state of your trade bar-by-bar.

The Entry (Strong Signals)
A "STRONG" signal is only generated when two conditions are met:

Price crosses the Trend Baseline.
ADX (Trend Strength) is above the threshold (Default: 25).
  • Note: Weak signals (small triangles) are shown when price crosses the baseline but ADX is low. These are risky and should be treated with caution.

The Stop Loss (Red/Green Crosses ++++)
Upon a strong entry, the script calculates a Stop Loss based on the Average True Range (ATR).
Long SL: Low - (ATR * Multiplier)
Short SL: High + (ATR * Multiplier)

The "Hard" Stop: Unlike trailing stops that move every bar, this SL is fixed to the volatility at the moment of entry. It only disappears if price hits it (marked by an Orange X) or if a reversal signal occurs.

The Targets (Blue/Purple Dots oooo)
The script projects two Take Profit levels based on your risk:
  • TP1 (Blue Dots): 1.5x your Risk.
    TP2 (Purple Dots): 3.0x your Risk.
    Smart Visuals: If price hits TP1, the dots disappear to keep your chart clean, letting you focus on TP2.


4. How to Use This Indicator
  • Step 1: Wait for a "STRONG" Label. Do not trade every crossover. Wait for the large triangle with the text label.
    Step 2: Place your Entry at the close of the signal bar.
    Step 3: Place your Physical Stop Loss exactly at the level of the Green/Red Crosses.
    Step 4: Place Limit Orders at the Blue Dots (TP1) and Purple Dots (TP2).


Management:
  • If the Orange X appears, your Stop Loss was hit. Exit the trade immediately.
    If a Weak Signal (small triangle) appears against your trade, consider tightening your stops, as momentum may be fading.


5. Settings Guide
  • Trend Baseline Length: Controls the sensitivity of the trend filter. Higher = Fewer signals, longer trends.
    ATR Length: Controls how "volatile" the Stop Loss calculation is.
    Stop Loss Multiplier: The "breathing room" for your trade. 2.0 is standard. 3.0 is for volatile assets like Crypto.
    TP Risk:Reward Ratios: Fully customizable. Default is 1.5R and 3.0R.


Risk Warning & Disclaimer
Trading financial assets involves a high level of risk and may not be suitable for all investors. The content, indicators, and signals provided by this script are for educational and informational purposes only and do not constitute financial, investment, or trading advice.

The "Adaptive Trend & Risk System" is a technical analysis tool based on historical price data and mathematical formulas (ATR, ADX, Hull MA). Past performance is not indicative of future results. Market conditions can change rapidly, and no indicator can guarantee profits or prevent losses.

By using this script, you acknowledge that:
  • You are solely responsible for your own trading decisions and risk management.You should never trade with money you cannot afford to lose.
  • The author of this script assumes no liability for any financial losses or damages incurred from the use of this tool.

Always consult with a qualified financial advisor before making investment decisions.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.