Skip to content
All library documents

Higher-Timeframe Moving Average Crossovers with Risk-Based Exits

Article TradingView scripts

Summary

This strategy compares two configurable moving averages calculated on selectable timeframes. The averages can use several common formulations and price sources, with optional gap smoothing. A confirmed crossover opens a long position and a confirmed crossunder opens a short position, provided the strategy is flat. The script adjusts higher-timeframe values around realtime bars to manage how the series is presented, though the document does not provide a detailed account of repainting behavior.

For exits, the initial stop is taken from the prior bar’s low for a long or high for a short, and the target is set using a configurable risk-to-reward multiple of that stop distance from the average entry price. The chart plots the averages, entry reference, and shaded stop and target regions. No performance results or robustness tests are included. Outcomes will depend on timeframe selection, average settings, execution assumptions, and how the prior-bar stop relates to the actual fill.

Key ideas

  • Long and short entries follow confirmed crossovers between two selectable higher-timeframe moving averages.
  • Each average can use a configurable source, length, timeframe, and supported moving-average type.
  • The initial stop references the prior bar’s low for longs and high for shorts.
  • Profit targets are calculated from entry price and stop distance using a configurable risk-to-reward multiple.
  • The document describes chart logic but supplies no evidence of profitability or robustness.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.