The following code was taken from Forex Robot developed by Dietcoke , this part of the EA deals with establishing an array list of pairs of interest
void CreateSymbolList()
{
int hFileName = FileOpenHistory("symbols.raw",FILE_BIN|FILE_READ);
int Records = FileSize(hFileName) / 1936;
int Counter = 0;
for(int i = 0; i < Records; i++)
{
string TempSymbol = StringTrimLeft(StringTrimRight(FileReadString(hFileName,12)));
if(MarketInfo(TempSymbol,MODE_BID) > 0 && PairAllowed(TempSymbol))
{
if( StringFind(Ignore.Pair,TempSymbol,0) < 0 && IndexAllowed(TempSymbol) )
{
ArrayResize(Pairs,Counter+1);
Pairs[Counter] = TempSymbol;
if(TempSymbol == Symbol()) ThisSymbolIndex = Counter;
//log("ThisSymbolIndex",ThisSymbolIndex,Pairs[ThisSymbolIndex]);
//log("CreateSymbolList: Counter=",Counter,TempSymbol,Symbol());
Counter++;
}
}
FileSeek(hFileName,1924,SEEK_CUR);
}
FileClose(hFileName);
return(0);
}
But lets say we want to introduce a RSI daily 20 period progesssion and we wanted to rank the pairs not alphabetically as above, but by RSI decending values - NOW How would I do that ???
void CreateSymbolList()
{
int hFileName = FileOpenHistory("symbols.raw",FILE_BIN|FILE_READ);
int Records = FileSize(hFileName) / 1936;
int Counter = 0;
for(int i = 0; i < Records; i++)
{
string TempSymbol = StringTrimLeft(StringTrimRight(FileReadString(hFileName,12)));
if(MarketInfo(TempSymbol,MODE_BID) > 0 && PairAllowed(TempSymbol))
{
if( StringFind(Ignore.Pair,TempSymbol,0) < 0 && IndexAllowed(TempSymbol) )
{
ArrayResize(Pairs,Counter+1);
Pairs[Counter] = TempSymbol;
if(TempSymbol == Symbol()) ThisSymbolIndex = Counter;
//log("ThisSymbolIndex",ThisSymbolIndex,Pairs[ThisSymbolIndex]);
//log("CreateSymbolList: Counter=",Counter,TempSymbol,Symbol());
Counter++;
}
}
FileSeek(hFileName,1924,SEEK_CUR);
}
FileClose(hFileName);
return(0);
}
But lets say we want to introduce a RSI daily 20 period progesssion and we wanted to rank the pairs not alphabetically as above, but by RSI decending values - NOW How would I do that ???