OPEN-SOURCE SCRIPT
Quality-Controlled Trend Strategy

Overview
This strategy demonstrates a clean, execution-aware trend framework with fully isolated risk management.
Entry conditions and risk logic are intentionally separated so risk parameters can be adjusted without altering signal behavior.
All calculations are evaluated on confirmed bars to ensure backtest behavior reflects real-time execution.
Design intent
Many scripts mix entries and exits in ways that make results fragile or misleading.
This strategy focuses on structural clarity by enforcing:
It is intended as a baseline framework rather than an optimized system.
Trading logic (high level)
Trend context
Entry
Risk management
Editing risk without affecting signals
All stop-loss and take-profit calculations are handled in a dedicated block.
Users can adjust:
without modifying entry conditions.
This allows controlled experimentation while preserving signal integrity.
Usage notes
Results vary by market, timeframe, and volatility conditions.
This script is provided for testing and educational purposes and should be validated across multiple symbols and forward-tested before use in live environments.
This strategy demonstrates a clean, execution-aware trend framework with fully isolated risk management.
Entry conditions and risk logic are intentionally separated so risk parameters can be adjusted without altering signal behavior.
All calculations are evaluated on confirmed bars to ensure backtest behavior reflects real-time execution.
Design intent
Many scripts mix entries and exits in ways that make results fragile or misleading.
This strategy focuses on structural clarity by enforcing:
- confirmed-bar logic only
- fixed and transparent risk handling
- consistent indicator calculations
- one position at a time
It is intended as a baseline framework rather than an optimized system.
Trading logic (high level)
Trend context
- EMA 50 vs EMA 200 defines directional bias
Entry
- Price alignment with EMA 50
- RSI used as a momentum confirmation, not as an overbought/oversold signal
Risk management
- Stop-loss based on ATR
- Fixed risk–reward structure
- Risk logic is isolated from entry logic
Editing risk without affecting signals
All stop-loss and take-profit calculations are handled in a dedicated block.
Users can adjust:
- ATR length
- stop-loss multiplier
- risk–reward ratio
without modifying entry conditions.
This allows controlled experimentation while preserving signal integrity.
Usage notes
Results vary by market, timeframe, and volatility conditions.
This script is provided for testing and educational purposes and should be validated across multiple symbols and forward-tested before use in live environments.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.