Consolidated Bars HL2

Top  Previous  Next

Consolidated Bars HL2 - computes a virtual bar based on the (high + low) / 2 which is formed from the combination of the most recent number of  bars identified in the "Bar Count" parameter.  These bars are continuous and always reflect the net of the previous bars average of the high and low. Every time a new bar arrives, the oldest bar is dropped and a new consolidated bar is generated. Unlike any moving average which might attempt to do the same, there is never any lag.  The indicator includes two "gap" parameters that let you decide how the indicator is computed when there is a gap in trading.

 

Unlike the TimeBar indicators which create bars based on time frames, the Consolidated Bars indicators creates bars based on a specified number of bars.

 

When used on a 5 minute chart, you can generate 10, 15,  20, 25, and 30 minute bars which update every 5 minutes by entering a Bar Count Size of 2, 3, 4, 5, and 6 respectively.

 

The Consolidated Bar indicators may be used on time, range, volume or tick charts.

 

Parameters:

Bar Count  - the number of most recent bars that will be consolidated into a virtual bar

 

Gap Half Days -

a value of 1 represents a 3 hour gap. A Gap Half Days value of 1 is useful for daily futures or early morning lack of trades in a range or volume environment. A Gap Half Days value of 1 will also work for an overnight gap in stock trading.        

 

values 2-10 represent the number of 12 hour periods which defines a gap

 

Gap Mode -

1) after a gap return “n/a” until “Bar Count” bars are available

2) after a gap use less bars to build up to “Bar Count”

 

open,high,low,close,volume,date - these are required parameters which are not to be changed

 

When used with range or volume bars, the chart can be configured to a small bar size and the Consolidated bars can provide access to a higher bar size attributes without having to wait for a genuine higher bar to complete. This effectively allows trading "inside" larger bars. On tick based charts (range and volume) these consolidated bars act like variable time bars. A 5 bar consolidation of a .50 range bar will not yield a 2.50 range bar. Rather it will indicate the range bar performance over the time it took to create the 5 bars.

 

"Gap Half Days" defines a gap in prices. As an example, stocks trade from 8:00 AM or 9:30 AM to 4:00 PM or 6:00 PM. Then there's an overnight trading gap. Also there's a weekend trading gap and a holiday trading gap. Often stock prices will move sharply up or down when trading resumes. By recognizing gaps, the system can avoid building opening bars which reach back to a prior day to determine high and low prices. Without this capability, the following problem would exist. In a 1 minute chart which is generating 15 bar consolidations, the first 14 bars after the open would be distorted by either the high or low of the previous day's closing 1 minute bar. This same distortion would appear on range or volume bar charts. This problem may be addressed with the Gap parameters. If Gap Half Days = 1 then any lack of trading for 3 hours will be identified and the resulting Consolidation bars will be restarted. This will happen every day, every holiday and every weekend, If Gap Half Days = 4 then daily trade gaps will be ignored but Consolidated bars will be reset on every 2 or 3 or 4 day weekend.

 

A restarted Consolidation bar ignores past bars and begins to accumulate data with the present bar. Using a Gap of 1 and an opening time of 9:30 AM on a 2 minute chart with a Bar Count of 5 the following occurs. Ten minute bars will be produced on a 2 minute boundary. However, every morning the first 10 minute bar will be exactly the same as the 9:32 AM bar. The second 10 minute bar will be a consolidation of the 9:32 AM and 9:34 AM bar and so on until 5 bars have been consolidated at 9:40 AM. This means that any computations using this data will be moving in the right direction and with the correct momentum even if last night's close was considerably different.

 

Since the system is aware of trade breaks, the Gap Mode parameter is available. If set to 1 then the output will return "n/a" until an adequate number of bars is available to Consolidate. In mode 2 the behavior will be as described in the previous paragraph. Be aware that any control presenting a value of "n/a" inside a trading strategy or optimization will suspend trading until the "n/a" is resolved. One consequence of this is that you could prevent trading during the first "Bar Count" bars of a range bar chart regardless of how much time is required to generate the bars.