Skip to content
YinYang
strategyActiveOpen Source

Machine Learning: SuperTrend Strategy TP/SL

Backtest a machine-learning SuperTrend workflow with configurable take-profit and stop-loss handling.

AlertsSource updated 2024-10-12Reviewed 2026-07-19
Machine Learning SuperTrend TP SL strategy publication chart on TradingView

Overview

Backtest a machine-learning SuperTrend workflow with configurable take-profit and stop-loss handling.

This open-source strategy applies machine-learning options to SuperTrend and adds configurable take-profit and stop-loss rules for historical strategy evaluation. Publication results must be read with their symbol, timeframe, settings, and cost assumptions.

Key capabilities

  • Machine-learning SuperTrend calculation
  • Long and short strategy signals
  • Take-profit controls
  • Stop-loss controls
  • TradingView strategy report

Configuration

Start with the documented controls

  • Choose the SuperTrend and machine-learning inputs.
  • Set take-profit and stop-loss assumptions.
  • Add realistic commission and slippage in Strategy Properties.

Tutorial

Learn the workflow in context

Step 1

How it works

This open-source strategy applies machine-learning options to SuperTrend and adds configurable take-profit and stop-loss rules for historical strategy evaluation. Publication results must be read with their symbol, timeframe, settings, and cost assumptions.

  • Machine-learning SuperTrend calculation
  • Long and short strategy signals
  • Take-profit controls
  • Stop-loss controls
  • TradingView strategy report

Step 2

Set up the script

Open the original publication, choose Use on TradingView, then add the script to the intended symbol and timeframe. Review each input before relying on the display; defaults are a starting point, not a universal recommendation.

  • Choose the SuperTrend and machine-learning inputs.
  • Set take-profit and stop-loss assumptions.
  • Add realistic commission and slippage in Strategy Properties.

Step 3

Create an alert

All current YinYang publications support TradingView alerts. Select a condition exposed by the script, confirm the symbol and timeframe, and test notifications before relying on them. This Alerts label does not by itself mean a webhook execution workflow has been verified.

Risk and results context

Strategy reports are historical and hypothetical. Results can change materially with symbol, timeframe, date range, settings, commission, slippage, liquidity, and execution conditions.

Signals, projections, and strategy outputs are analytical tools—not financial advice or guarantees of future results. Trading involves substantial risk.

No numerical performance claim is presented here because symbol, timeframe, tested date range, settings, commission, and slippage must be shown together. Review those parameters inside TradingView before interpreting any strategy report.

This guide is a rewritten YinYang overview. For the author’s complete source description and release notes, view the original publication.

Related scripts

Continue exploring the library

Ultimate

Use the complete TradingView library

Ultimate combines the web analytics platform with all six featured invite-only TradingView tools.

TradingView® is a trademark of TradingView, Inc. YinYang Algorithms is not affiliated with or endorsed by TradingView. A separate TradingView account is required; paid TradingView plans are not included.