Skip to content
All library documents

Trading Direction from Selected-Period High and Low Levels

Article TradingView scripts

Summary

This script retrieves the high and low from a selectable timeframe, such as daily, weekly, or monthly, with a lookback shift that can select the current or an earlier period. It then maintains a directional state: price above the retrieved low yields a long bias, while price below the retrieved high yields a short bias. An optional reverse setting flips those directions. The script submits entries in the indicated direction and colors bars by state.

Although named a high-low levels backtest, the rules shown do not use the intuitive breakout comparisons of price above the period high or below the period low. The two thresholds are assigned in a way that makes the stated conditions worth checking carefully against the intended behavior and platform semantics. The document provides no performance statistics, risk controls, or validation. It is an educational example of sourcing higher-timeframe levels and translating comparisons into persistent directional signals, rather than evidence of a reliable trading edge.

Key ideas

  • The selected timeframe and lookback determine which period high and low are used.
  • The script forms long and short states from comparisons with those levels.
  • A reverse option swaps the generated directions.
  • Bar colors visualize the active directional state.
  • The source includes no reported results or explicit trade risk controls.

Tags

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