Here is the data:
Bar# Open High Low Close
0 447.6 448.9 447.4 448.9
1 449.0 449.3 447.8 447.8
2 447.7 448.2 446.7 446.7
j=CurrentBar-0;//0 is simply the first bar in the above data
sw = File.AppendText(@FilePath);
if(dExp.WCCIDirection[j] == 1)//1 = Long and -1 = Short
sw.Write(","+Close[0]+","+MAX(High,j-1)+",,");//LONG
else
sw.Write(","+Close[0]+","+MIN(Low,j-1)+",,");//SHORT
sw.Flush();
sw.Close();
The trade is Long and this triggers @ 447.4 in the middle of bar #2 having made its high for the bar, so j==2 and I would expect to get:
,447.4,449.3,, emphasis added, High of bars 1 and 2 (j-1 bars back)
what I get is:
,447.4,MAX(High,1),, what happened to my double?
If I substitute MAX(High,j-1)[0] I get:
,447.4,448.2,, Just I would expect (high of current bar)
If I substitute MAX(High,j-1)[1] I get:
,447.4,449.3,, Just what I would expect (high of previous bar)
and [2] returns 448.9, what I would expect.
Please help.
Snap

Comment