[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Issue with using string format



PureBytes Links

Trading Reference Links

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 ;



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/