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

RE: [amibroker] Re: Problem with AddToComposite



PureBytes Links

Trading Reference Links

Hello,

You have bug in your formula.
The "w" variable may be UNDEFINED if it ticker does not match 
to any listed symbol.

You have to INITIALIZE 'w' variable in all control paths.

Corrected code follows:

t = Name();

w = 0; // IMPORTANT - initialize it for REMAINING cases !!!

if( t == "C" ) w = 1;
if( t == "KO" ) w = 1;
if( t == "DOW" ) w = 1;
if(t== "EXC" ) w = 1;
if(t== "XOM" ) w = 1;
if(t== "GE" ) w = 1;
if(t== "PFE" ) w = 1;
if(t== "PG" ) w = 1;
if(t== "UPS" ) w = 1;
if(t== "WMT" ) w = 1;

/* AddToComposite statements are for Automatic Analysis -> Scan */
/* add Close price to our index OHLC fields */
AddToComposite(w*C, "~NYSE Wave", "C" );
AddToComposite(w*O, "~NYSE Wave", "O" ); 
AddToComposite(w*H, "~NYSE Wave", "H" );
AddToComposite(w*L, "~NYSE Wave", "L" );
AddToComposite(w*V, "~NYSE Wave", "V" );

/* add one to open intest field (we use this field as a counter) */
AddToComposite( 1, "~NYSE Wave", "I" );


Buy = 0; // required by scan mode

/* this part is for Indicator Builder */
Graph0 = Foreign( "~NYSE Wave", "C" )/Foreign( "~NYSE Wave", "I" );

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "aereoplain" <aereoplain@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, June 22, 2004 9:57 PM
Subject: [amibroker] Re: Problem with AddToComposite



> 
> t = Name();
> if( t == "C" ) w = 1;
> if( t == "KO" ) w = 1;
> if( t == "DOW" ) w = 1;
> if(t== "EXC" ) w = 1;
> if(t== "XOM" ) w = 1;
> if(t== "GE" ) w = 1;
> if(t== "PFE" ) w = 1;
> if(t== "PG" ) w = 1;
> if(t== "UPS" ) w = 1;
> if(t== "WMT" ) w = 1;
> 
> /* AddToComposite statements are for Automatic Analysis -> Scan */
> /* add Close price to our index OHLC fields */
> AddToComposite(w*O, "~NYSE Wave", "O" ); 
> AddToComposite(w*H, "~NYSE Wave", "H" );
> AddToComposite(w*L, "~NYSE Wave", "L" );
> AddToComposite(w*C, "~NYSE Wave", "C" );
> AddToComposite(w*V, "~NYSE Wave", "V" );
> 
> /* add one to open intest field (we use this field as a counter) */
> AddToComposite( 1, "~NYSE Wave", "I" );
> 
> 
> Buy = 0; // required by scan mode
> 
> /* this part is for Indicator Builder */
> Graph0 = Foreign( "~NYSE Wave", "C" )/Foreign( "~NYSE Wave", "I" );
> 
> 
> 
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/