Login Page - Create Account

Technical Studies Reference


Previous/Period OHLC-Variable Period

This study calculates and displays lines for the Open, High, Low, and Close (OHLC) values from the previous or current specified time period, on each bar in the chart.

It can be used both on both Intraday and Historical charts. The calculations are derived from the data in the chart itself.

If the Use Current Period Input is set to Yes, then the OHLC values will be for the current period instead of the previous period.

To do Weekly Open, High, Low, and Close values, set the Time Period Type to Weeks and set the Time Period Length to 1.

When Time Period Type is set to Minutes or Days, the time periods for the Open, High, Low, and Close lines are always aligned to the Start Time or the Evening Start Time if using the Evening Session, which is set in the Session Times settings for the chart.

When back-referencing data for the OHLC values, this study is able to skip periods of time where there is insufficient data to calculate OHLC values from (such as weekends, partial trading days and holidays in the case of a 1-Day period). This is a very useful feature. For more information, refer to the Input Minimum Required Time Period as % below. When using this feature it is necessary to also set the Auto Skip Period of No Trading Input to Yes.

If the Minimum Required Time Period as % is set too high it is possible that the OHLC lines will not appear or another effect is that the OHLC lines will not change from the prior period and stay the same. You may need to reduce the percentage using this Input in the case of Tick, Volume, and Range charts, since those have a variable number of bars per period. You may want to use 20% or lower to avoid skipping a period when the study is back-referencing data.

Missing OHLC Lines: If you are missing the OHLC lines for a particular period in the chart and there is no data for the period of time immediately before the time where they are missing, then the cause is simply due to the prior data not being available.

Inputs

  • Time Period Type: Sets the type of time period for the OHLC lines. This Input works in conjunction with Time Period Length.

    For Open, High, Low, Close lines which need to be based upon a trading day, set this Input to Days (not Minutes) and the Time Period Type Input to 1.

    When using Days and Time Period Length is set to a value greater than 1, then the way this works is that from a reference day (Sunday), the number of days is counted from that day and repeats in segments equal to the Time Period Length. So it is not a rolling time length from day to day or counted from the last day in the chart.
  • Time Period Length: Sets the quantity to be used with Time Period Type. For example, for one hour set this to 60 and Time Period Type to Minutes.

    It is essential that based upon the Time Period Type and Time Period Length settings that there is a sufficient amount of data loaded in the chart with the Days to Load Chart Setting. For example, if these are set to Months and 1 respectively, then the chart is set to load at least 62 days of data.
  • Minimum Required Time Period as %: This study employs special logic when looking back at the previous period to calculate the Open, High, Low, Close values from, to determine if there is sufficient data. If there is insufficient data, it looks back to the period before the first period it originally referenced. This is very useful weekends, holidays and partial trading days.

    You can control the functioning of this period skipping feature with this Input. For example, if you want there to be at least 50% or more of the bars needed for a period that the OHLC values are calculated from, then set this Input to 50.

    This Input only applies if Auto Skip Period of No Trading is set to Yes.

    When this study determines the number of bars that are needed for a period, it does not consider the Session Times settings in Chart >> Chart Settings. For example, if you are just including the Day Session only in your chart, then there are going to be fewer bars available. Therefore, you need to consider this when setting this percentage. So if you have less than the full 24 hour session of bars in the chart, then you will need to use a lower percentage to avoid skipping periods.
  • Round to Tick Size: Set to Yes to round off the outputted values to the symbols Tick Size. The Tick Size is set in Chart >> Chart Settings.
  • Use Current Period: When this Input is set to Yes, the Open, High, Low, Close values drawn at a bar will be for the time period containing that chart bar and not the previous period.
  • Display Debugging Output (slows study calculations): Set this to Yes to display debugging output in the Message Log.
  • Forward Project OHLC Lines: Set this to Yes to extend the OHLC lines into the Forward Projection area on the right side of the chart.

    When the OHLC lines are extended forward, the values are not necessarily extended at the same values as they are at the last bar in the chart. For each future chart bar, the values will be what they should be at the Date-Time of that future bar. For more information about these Date-Times, refer to Time Scale. So these lines in the Forward Projection area can be at different price levels compared to the last bar in the chart. If this is not the behavior that you want, then you need to set this Input to No. It is also important to understand that the true Trading Day Date of a particular chart bar can be one day forward. For a complete explanation, refer to Understanding Trading Day Dates Based on Session Times.

    As an alternative to setting Forward Project OHLC Lines to Yes, instead use the Line At Last Bar to Edge Draw Style for the Open, High, Low, Close Subgraphs.
  • Number Of Days To Calculate: This Input specifies the number of days in the chart, starting from the last bar, that the study should be calculated over. This includes weekends and days without data.
  • Auto Skip Period of No Trading: Set this to Yes to automatically skip periods of insufficient data in the chart when Use Current Period is set to No. For more information about this, refer to the Minimum Required Time Period as % Input. Set this to No to prevent automatic skipping of periods of insufficient data.

    When this is set to No, then this means when referencing the prior period in the chart, the prior period will be used even if there is insufficient data. Sometimes for proper functioning of the study, this needs to be set to No. For the most stable behavior of this study, it is recommended to set this to No so the study always references exactly the prior period of time. Otherwise, while the behavior is very specifically as programmed, it could have behavior which appears to be unexpected.

*Last modified Monday, 03rd October, 2022.