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

[amibroker] Customising Explore for each Symbol



PureBytes Links

Trading Reference Links

I am having trouble coding AFL using the explore function to scan for 
MA Crosses depending on the settings in a .txt file. 

My text file is: [name to match symbol name],short MA, long MA
eg:
AAPL,20,50

I would like to explore all symbols in the database, and if the name 
matches the current symbol being explored:

a) Output "2" to an exploration column if short MA has crossed long 
MA for that symbol today
b) Output "0" to the same column if symbol not found in .txt file, or 
no cross today

My code is like this so far, but it isn't working:

cnt = 1;
gg = 0;

fh = fopen( "C:\\test.txt", "r"); 
if( fh ) 
{ 
   while( ! feof( fh ) ) 
   { 
    a = fgets( fh );    
		nm = strextract(a,0);
	
		if (nm == name())
		{
			shortma = strtonum(strextract(a,1));
			longma = strtonum(strextract(a,2));

			gg[cnt] = Iif(Cross(shortma,longma),2,0);
			
		}
		else
		{
			gg[cnt] = 0;
		}	 		
    cnt = cnt + 1;
   }  
} 
fclose( fh ); 

filter = 1;
AddColumn(gg,"CROSS SIGNAL?");


Any help to correct the code would be great - thanks!





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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

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