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

[amibroker] Any way to make forward ref a zero value when not available?



PureBytes Links

Trading Reference Links

This is a snippet of my exploration.  It will look back and provide me
max possible % gain based on a breakout of a prior high. 

The issue is that if future reference are found, say in ref(High,1),
for example, it reproduces the last valid value for High. 

Is there a way to make the future references be zero (0), instead of
the last available quote value?

---- snippet ----
gainAfterBO0= IIf( High > Ref(High, -1), High-Ref(High,-1), 0);
gainAfterBO1= IIf( High > Ref(High, -1), Ref(High,1)-Ref(High,-1), 0);
gainAfterBO2= IIf( High > Ref(High, -1), Ref(High,2)-Ref(High,-1), 0);
gainAfterBO3= IIf( High > Ref(High, -1), Ref(High,3)-Ref(High,-1), 0);

Filter = 1;

AddColumn(gainAfterBO0/MA(Close,20), "BO0", 1.4);
AddColumn(gainAfterBO1/MA(Close,20), "BO1", 1.4);
AddColumn(gainAfterBO2/MA(Close,20), "BO2", 1.4);
AddColumn(gainAfterBO3/MA(Close,20), "BO3", 1.4);
--- end -----

RESULT For One Symbol as of 3/16/06 for 1 day
=============================================
Ticker	Date/Time	BO0	BO1	BO2	BO3	
SNDK	3/16/2006	0.0031	0.0031	0.0031	0.0031	

In this example, i'd like to see BO1, BO2, BO3 be zero since the
are for the future and not valid results.

Thanks for any suggestions.
AP






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

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

<*> 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/