All I want to do is create custom range bars (real time) with the following logic.
The logic is extremely easy in backtesting...Just the syntax for code in the 'type' directory for live bars.
* Enter the Bar Height in ticks.
* Every Close must have actually been traded.
* The next Open must equal the previous Close...At The Exact Same Tick, Time, and Price.
* There can Never be a bar < the requested bar height.
* Never close a bar before the requested bar height is reached.
Not overnight, Not in a new session, Not over a holiday, etc.
* As soon as the bar height is reached or exceeded, Close it and put the volume
in that bar...AND immediately open the next bar On That Exact Same Tick
with a Volume of 0.
* If there is a Gap beyond the requested Bar Height, fine, Close that bar on that price & open a new one at that same price...Even is no 2nd trade is made at that price. DO NOT create Dummy/Phantom bars that show bogus/untraded Close values.
Comment