Medina Ohio USA
Experience: Advanced
Platform: NinjaTrader
Broker: Amp/CQG
Trading: Nasdaq 100
Posts: 4 since Aug 2012
Thanks Given: 1
Thanks Received: 0
|
Has anyone successfully programmed "Type" Range Bars for Ninja (not as an indicator)?
I have had 2 Ninja contractors working on it for over a week now. We cannot get it to work properly when...
* There are 2 Ticks in a row where they have different prices, and we request 1 tick bars.
For example: tick1=750.1, tick2=750.2, tick3=750.3, tick4=750.4, tick5=750.5, etc.
When a sequence occurs similar to the one above, All of these bars are lumped into 1 big bar instead of several smaller bars. The bar would be similar to 750.1 to 750.5!...when it should be:
bar1=750.1 to 750.2, bar2=750.2 to 750.3, bar3=750.3 to 750.4, bar4=750.4 to 750.5
I started with Ninja's Range Bar "Type" code. "time, open, high, close,...etc." all match the Data Manager!
bar.Time, bar.Open, bar.High, ...etc. are all off by at least 1 bar & usually represent the highest high and lowest low for some unknown time range.
When more than 1 bar in a row has the same price, the bars are programmed & work perfectly.
* Tick1=750.1, Tick2=750.1, Tick3=750.2, Tick4=750.2...This results in a bar from 750.1 to 750.2.
This is guts of the code (this is only 1 of dozens of things we have tried!):
if(high - low >= rangeValue)
{
AddBar(bars, close, close, close, close, time, 0, isRealtime);
}
else
{
UpdateBar(bars, open, high, low, close, time, volume, isRealtime);
}
* All I am trying to do is create Range Bars where the Close is Valid and was Actually Traded!
* The Open Always Equals the previous Bar's Close
* As soon as the bar equals or exceeds the requested bar height
Close that bar & open a new bar where the Open==the previous Close.
|