Hi,
I have created the following example to help illustrate an issue i am running
into. Can someone tell me why the code below always prints out "lower 0 day
later"?
Basically when the signal occurs, i want to see the performance 1 and 2 days
later. I want to print out on which day, if any, the price is lower. The
problem is, even though there are many cases where 'whichDayLower' contains
either 1 or 2, the variable 'strLower' does not reflect that.
-----------------------------------------------------------
N1 = 1;
N2 = 2;
sig = cross(ma(c,50),ma(c,200));
pctChgN1 = (ref(C, N1) - C)/C * 100;
pctChgN2 = (ref(C, N2) - C)/C * 100;
whichDayLower= iif((pctChgN1 <0), N1, 0);
whichDayLower= iif((pctChgN2 <0) && !whichDayLower, N2, 0);
strLower = StrFormat("lower %g day later", whichDayLower);
AddColumn (C, "Close", 1.2);
AddColumn (whichDayLower, "Close", 1.2);
AddTextColumn(strLower , "Close");
AddColumn( pctChgN1 , "pctChgN1" , 1.2, IIf(pctChgN1 < 0, colorRed,
colorGreen));
AddColumn( pctChgN2 , "pctChgN2" , 1.2, IIf(pctChgN2 < 0, colorRed,
colorGreen));
Filter = sig ;