As can see in my code, I using barsproress of 1, which is the 1 day bars series.
I am calculating the pivot for yesterday for hpivot. I then calculate the next day after to draw the pivot. This works fine thus far.
I then have a high, low, close, open, Time[1] and Time[0] lines being drawn on the chart. Screenshot of the lines attached.
The red vertical line is Time[1]. Blue vertical is Time[0]. Since these are day bars, when I use Open[0], then it should be opening close to the red line. But as you can see the purpose line (Open[0]) is the open of 4 bars after the red line.
I am using the Forex template, which is setup using its defaults.
I have included the code below that made the attached screenshot.
What am I doing wrong that the Open, High, Low, Close is not falling within Time[1] and Time[0]?
By the way, I trying to port the code from NT7 to NT8. So in NT7 it works just fine with no problems. After I ported it to NT8, now it is not working as designed. I add this in case it helps with diagnosis.
Thanks
Stearno
if (BarsInProgress == 1) { hpivot = (High[1]+Low[1]+Close[1])/3; PivotBegin = Time[1]; PivotEnd = Time[0]; CurrentDayBegin = (CurrentBar - Bars.GetBar(Time[0]))+1; CurrentDayEnd = CurrentDayBegin - barsinaperiod+1; //Print(hpivot +" "+ CurrentDayBegin +" "+ CurrentDayEnd +" "+ PivotBegin +" "+ PivotEnd); Print(CurrentDayBegin +" "+ CurrentDayEnd +" "+ PivotBegin +" "+ PivotEnd); //Draw.Line(this, "MissedPivotAlways"+k, false, CurrentDayBegin, hpivot, CurrentDayEnd, hpivot, Brushes.Orange , DashStyleHelper.Dash,1); //Draw.Line(this, "Close"+k, false, PivotBegin, Close[0], PivotEnd, Close[0], Brushes.Blue , DashStyleHelper.Solid,1); // k++; if(hpivot > High[0] || hpivot < Low[0]) { Draw.Line(this, "Low"+k, false, PivotBegin, Low[0], PivotEnd, Low[0], Brushes.Yellow , DashStyleHelper.Solid,1); Draw.Line(this, "Open"+k, false, PivotBegin, Open[0], PivotEnd, Open[0], Brushes.Purple , DashStyleHelper.Solid,1); Draw.Line(this, "High"+k, false, PivotBegin, High[0], PivotEnd, High[0], Brushes.Red , DashStyleHelper.Solid,1); Draw.VerticalLine(this, "CurrentDayend"+k, Time[0], Brushes.Blue); Draw.VerticalLine(this, "CurrentDayeg"+k, Time[1], Brushes.Red); //Print(hpivot +" "+ High[0] +" "+ Low[0]); k++; Draw.Line(this, "MissedPivot"+k, false, CurrentDayBegin, hpivot, CurrentDayEnd, hpivot, DayPivotColor , DashStyleHelper.Solid,2); StoreMP(hpivot,PivotBegin); CalcButUnstored = false; }
Comment