Ultimate Strategy Template

Feb 8, 2021

Static chart image
Signals
Money Management

The Ultimate Strategy Template indicator provides a modular framework to convert standard indicators into backtestable strategies with built-in risk management and alert capabilities. It serves as a universal engine that can be connected to any indicator via a simple plot-based connector to analyze performance statistics and automate trade signals.

Usage

The Usage section describes how the script can be used, examples should be provided in this section. To use this template, your source indicator must be modified to include a "Connector" plot.

  1. Modify Source Indicator: Add a plot to your existing indicator code that outputs 1 for a buy signal, -1 for a sell signal, and 0 otherwise. Example: Signal = buy_condition ? 1 : sell_condition ? -1 : 0 plot(Signal, title="Connector", display=display.none)
  2. Setup: Apply both your modified indicator and the Ultimate Strategy Template to the same chart.
  3. Connection: Open the template settings and select the "Connector" plot from your indicator as the Data Source.

The template will then execute trades based on these signals, allowing you to refine strategy parameters such as stop-losses, take-profits, and session filters without recoding.

Details

The script is designed as a standalone execution engine. It decouples signal logic (the "what") from trade management (the "how"). By using the input.source function, it pulls external data streams into its internal logic.

The template includes advanced risk management features such as equity protection and trade frequency limits. It also features built-in support for strategy alerts, enabling automated execution or notifications. Visual aids, such as candle coloring based on trade state and plotted SL/TP levels, provide immediate feedback on the strategy's current status and exit targets.

Settings

General & Filtering

  • Data Source: Select the plot output from your source indicator.
  • Use Custom Close: Enables custom exit signals (2 for long exit, -2 for short exit).
  • Colour Candles: Highlights candles based on current trade direction.
  • Trading Session: Restricts entries to specific time ranges (e.g., "0900-1600").
  • Open/Close Direction: Filters signals to allow only Longs, only Shorts, or both.
  • Date Range Filtering: Sets specific start and end dates for backtesting.

Risk Management

  • Max consecutive loss/win trades: Stops trading after a specified streak length.
  • Max Total DrawDown: Halts trading if equity drops by a certain percentage.
  • Limit trades per day/week: Restricts trade frequency to prevent overtrading.

Exit Management

  • Stop Type Selection: Choose between None, Percent, Trailing Stop, or ATR-based stops.
  • Take Profit Type: Choose between None, Percent, or ATR-based profit targets.
  • Risk/Reward Ratio: Sets the multiplier for ATR-based exits.

FAQ

How do I link my own indicator to this template? You must add a plot to your indicator that returns 1 for Long and -1 for Short, then select that plot in the "Data source" input of the template settings.

Can I use this for live automated trading? Yes, the template includes strategy-specific alerts that trigger on entry and exit conditions, which can be connected to third-party execution bots.

How do I access the Ultimate Strategy Template? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.