All indicators

Supertrend - Intraday

Jun 2, 2021

Static chart image
SignalsTime BasedVolatility

The Supertrend - Intraday indicator is a strategy-oriented tool designed to automate trend-following entries and exits specifically within user-defined market hours. It combines the classic Supertrend calculation with session-based filtering to ensure positions are only held during active trading windows.

Usage

The Usage of this tool is centered around intraday trend following. When the price crosses above the Supertrend line within the specified session, a long position is initiated. Conversely, when the price drops below the line, a short position is triggered. Because this is designed for intraday traders, the strategy will automatically square off any open positions once the defined market session concludes.

Examples of usage include:

  • Trend Reversals: Using the multiplier and ATR period to catch mid-day swings.
  • Session Management: Restricting trading to high-liquidity periods (e.g., the New York or London open) to avoid overnight gap risks.
  • Automated Square-off: Ensuring no trades remain open after hours by setting the "Market session" end time to match local exchange closing times.

Details

This script utilizes the built-in ta.supertrend function, which calculates a trend line based on the Average True Range (ATR) and a multiplier. The core logic includes a session-checking function (barInSession) that validates whether the current bar falls within the user's preferred trading time. If the session expires, the strategy.close_all function is called to exit all market exposure. The visual output displays a color-coded line: green for support (bullish) and red for resistance (bearish).

Settings

  • Market session: Defines the specific time range (in "HHMM-HHMM" format) during which the strategy is allowed to enter trades and maintain positions.
  • Multiplier: A coefficient applied to the ATR to determine the distance of the Supertrend line from the price. Higher values result in fewer, more significant signals.
  • ATR Period: The lookback period used to calculate the Average True Range, determining the sensitivity of the volatility measurement.

FAQ

How do I change the trading hours for my local market?

You can adjust the "Market session" input in the settings panel. Enter the start and end times in 24-hour format (e.g., "0930-1600" for 9:30 AM to 4:00 PM).

What happens if a signal occurs outside of the market session?

The strategy will ignore any signals that occur outside the defined session and will actively close any remaining open positions once the session ends.

How can I access this tool?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.