OPEN-SOURCE SCRIPT

Delayed Opening Price Line with Guardrails

Updated
This Delayed Opening Price Line with Guardrails indicator will draw 5 price level lines on the chart each day, beginning at the open of the first candle after a delay period specified by the user in the indicator settings. The default delay is 30 minutes from market open.

The lines are drawn at the open price of the first candle after the delay period, and then a specified increment above and below that price level. These increments default to 80 and 100, and can be adjusted in the indicator settings.

Most markets, indices, and equities have a finite and consistent range of price movement within a trading day. Eg. a particular stock may usually move no more that $50 up or down in a given day, which can be proven by looking at a historical chart. This indicator allows the user to quickly display that range on the chart once it's been defined.

Important note: This indicator is designed to be used on an intra-day chart - eg. minutes, or hourly. It will give an error if used on a longer time-frame chart.

Release Notes
This Delayed Opening Price Line with Guardrails indicator is based on the idea that most markets, indices, and equities have a finite and consistent range of price movement within a trading day. Eg. a particular stock may typically move no more that $50 up or down in a given day, which can be proven by looking at a historical chart. This indicator allows the user to quickly display that price range on the chart once it's been identified by the user's research.


This indicator will draw 5 price level lines on the chart each day, beginning at the first candle after a delay period specified by the user (default is 30 minutes from market open).

The lines are drawn at the specified price (open, high, low, close, etc.) from the first candle after the delay period (default is Open), and then at specified increments above and below that price level (defaults are 80 and 100).

  • USAGE:

  1. Determine the typical range of the underlying you are trading
  2. Determine the delay from market open you wish to use to set your range
  3. Set your parameters in the indicator settings
  4. Manage risk by trading inside or outside these parameters, depending on your trade strategy


Important note: This indicator is designed to be used on an intra-day chart only - eg. minutes, or hourly. It will give an error if used on a longer time-frame chart.

  • SETTINGS[**]Show Historical Data - Display only the current day's price lines for real-time use only, or show historical lines for additional analysis.
    [**]Delay After Market Open - length of time, in ticks or minutes, to delay before setting the starting price for the price lines. *Note that due to a PineScript limitation this list has longer timeframes than can be used with this indicator - I hope to resolve this in a future version.
    [**]Price to Use - sets the "Source" of the price to use for the start price, standard options are: Open, High, Low, Close, hl2, hlc3, ohlc4, hlcc4. You can find a great definition of these sources here (I have no affiliation here, just found it a helpful resource).
    [**]Near Guardrail Distance - the distance in chart units (dollars, etc.) from the delayed session start price for the first set of lines to be drawn (default is 80)
    [**]Far Guardrail Distance - the distance in chart units (dollars, etc.) from the delayed session start price for the second set of lines to be drawn (default is 100)
    Note: it occurs to me as I write this that either one could be farther or nearer to the money, so in a future version I will likely change these labels to Guardrail 1 and Guardrail 2, instead of near and far.
    [**]Style Settings on Inputs page - I think these are self explanatory, so I will spare you additional reading


  • CHANGES IN THIS VERSION:

  • [**]Added Price to Use input
    [**]Swapped default colors (by request of some friends, sorry if this confuses anyone)
Release Notes
This Delayed Opening Price Line with Guardrails indicator is based on the idea that most markets, indices, and equities have a finite and consistent range of price movement within a trading day. Eg. a particular stock may typically move no more that $50 up or down in a given day, which can be proven by looking at a historical chart. This indicator allows the user to quickly display that price range on the chart once it's been identified by the user's research.

This indicator will draw 5 price level lines on the chart each day, beginning at the first candle after a delay period specified by the user (default is 30 minutes from market open).

The lines are drawn at the specified price (open, high, low, close, etc.) from the first candle after the delay period (default is Open), and then at specified increments above and below that price level (defaults are 80 and 100).

USAGE:
  1. Determine the typical range of the underlying you are trading
  2. Determine the delay from market open you wish to use to set your range
  3. Set your parameters in the indicator settings
  4. Manage risk by trading inside or outside these parameters, depending on your trade strategy


Important note: This indicator is designed to be used on an intra-day chart only - eg. minutes, or hourly. It will give an error if used on a longer time-frame chart.

SETTINGS:
  • Show Historical Data - Display only the current day's price lines for real-time use only, or show historical lines for additional analysis.
  • Delay After Market Open - length of time, in ticks or minutes, to delay before setting the starting price for the price lines. *Note that due to a PineScript limitation this list has longer timeframes than can be used with this indicator - I hope to resolve this in a future version.
  • Price to Use - sets the "Source" of the price to use for the start price, standard options are: Open, High, Low, Close, hl2, hlc3, ohlc4, hlcc4. You can find a great definition of these sources here (I have no affiliation here, just found it a helpful resource).
  • Near Guardrail Distance - the distance in chart units (dollars, etc.) from the delayed session start price for the first set of lines to be drawn (default is 80)
  • Far Guardrail Distance - the distance in chart units (dollars, etc.) from the delayed session start price for the second set of lines to be drawn (default is 100)
    Note: it occurs to me as I write this that either one could be farther or nearer to the money, so in a future version I will likely change these labels to Guardrail 1 and Guardrail 2, instead of near and far.
  • Style Settings on Inputs page - I think these are self explanatory, so I will spare you additional reading


CHANGES IN THIS VERSION:
  • Added Price to Use input
  • Swapped default colors (by request of some friends, sorry if this confuses anyone)
  • Tightened up code
  • Updated documentation
Release Notes
CHANGES IN THIS VERSION:
  • Fixed issue where price label overlapped lines when zoomed in on chart
  • Renamed Near and Far Guardrails to Guardrail 1 and 2
  • Changed Default color for Guardrail 2 to "aqua" (very similar) which is part of the default color set and thereby reduced some code
Release Notes
CHANGES IN THIS VERSION:
  • Fixed an issue where lines were only drawn on the past ~10 days
  • Added a vertical line at the start of the session with a control in settings to toggle it off or on
pricelevelspricelinespricerangeSupport and Resistance

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer