PureBytes Links
Trading Reference Links
|
Hello,
I am a fairly new AmiBroker user, and I am trying to code up a
Sector Ranking tool. (Using FOR loops, which is inefficient) My
intent is to run this every so often and then insert the results
into a trading system to help adjust positionscore and buy/sell
indicators.
Below is the code I am using. However, when I try to run this
forother than the current day, each day comes up with the same
scores. I believe it is probably due to the third FOR loop (which I
founhd int he AmiBroker users guide), but I am unsure why. Also, is
there a way to use indicators like MACD on Foreign(ie not current)
stocks?
Thanks in advance for any help you can provide,
James
//This is a Sector Ranking exploration
Filter = 1;
for (i= 0; i<1; i++)
{
Seclist = CategoryGetSymbols(categorySector, i);
SecSum = 0;
NumSec = 0;
NullSec = 0;
x = 0;
y1 = 0;
y2 = 0;
SectorRelStrength = 0;
for( k = 0; ( sym = StrExtract( Seclist, k ) ) != ""; k++ )
{
x = Foreign( sym, "close");
y1 = MA(x,3);
y2 = MA(x,10);
if (x[BarCount-1] != 0) // Verify current symbol has data
associated with it
{
for( m = BarCount-7; m < BarCount; m++ )
{
// Insert ranking rules here as
if/else rules.
if( x[ m ] > y1[ m ] )
SecSum[m] = SecSum[m]+1;
else
SecSum[m] = SecSum[m];
}
NumSec = NumSec+1;
}
else
NullSec = NullSec+1;
}
SectorRelStrength = SecSum[m-1]/NumSec[m-1];
AddTextColumn( CategoryGetName( categorySector, i), "Sector
name" );
AddColumn( SectorRelStrength, "SectorRelStrength", 1.4 );
------------------------------------
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/
|