PDA

View Full Version : Erroneous open...


Sleeping Troll
03-27-2010, 06:58 PM
I have the following script in OnBarUpdate:

CanID[CanNumber] = "Current Day";
Fast[CanNumber]= 6;
Slow[CanNumber]= 13;
Smooth[CanNumber] = 9;
numStdDev[CanNumber] = 2;
period[CanNumber] = 14;
TOI = Time[0];
barsAgo=GetBar(new DateTime(TOI.Year,TOI.Month,TOI.Day,00,00,00));
SubjBar = HighestBar(High,barsAgo);
Canhigh[CanNumber] = High[SubjBar];
SubjBar = LowestBar(Low,barsAgo);
Canlow[CanNumber] = Low[SubjBar];
Canopen[CanNumber] = Open[barsAgo];
Canclose[CanNumber] = Close[0];

Occasionally the open price will be outside of the high and low, as if it were "clinging" to the open from the previous session. I am lost! Please help!

NinjaTrader_Austin
03-28-2010, 08:51 PM
Sleeping Troll, I'm not sure what exactly your code is doing. Can you please further explain what is going on and why you think the open is wrong? This little bit of code doesn't fully explain what you're trying to do. Is your variable 'Canopen' the one obtaining a "wrong" value? If so, what value of barsAgo is being evaluated?