How to re-Order an array from Forex Robot

Post Reply
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

How to re-Order an array from Forex Robot

Post by lucklogic »

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 ??? :roll:
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: How to re-Order an array from Forex Robot

Post by lucklogic »

Nobody helped me here but luckily for me, they did on Forex Factory :lol:
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: How to re-Order an array from Forex Robot

Post by dietcoke »

lucklogic wrote:
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 ??? :roll:
Sorry I never saw this, I would have helped. Its a problem I've noticed with FR. It doesn't always open the pair you really want it to.

Is there any chance you can share the solution you ended up with and I'll tray and incorporate it into the main bot?
Image
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: How to re-Order an array from Forex Robot

Post by mobthehop »

lucklogic - could you please share the code so that we all can learn...

Cheers
User avatar
lucklogic
Trader
Posts: 85
Joined: Mon Jan 23, 2012 6:26 pm
Location: On The Hoe in Plymouth, UK

Re: How to re-Order an array from Forex Robot

Post by lucklogic »

mobthehop wrote:lucklogic - could you please share the code so that we all can learn...

Cheers

Look at the stuff Baluda is doing in the 10.2 thread, its a step up levels better than anything that I found previously and is doing exactly what is required;- 8-) re-ordering arrays
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: How to re-Order an array from Forex Robot

Post by SteveHopwood »

lucklogic wrote:Nobody helped me here but luckily for me, they did on Forex Factory :lol:
There is a lot of expertise available at FF. Glad you found a solution.

I am not surprised that nobody here could or would help; most of those who could help are a tad busy. The way in which you presented your code did not make reading it easy. When you want people to read your code, you need to present it in a readable form. In future, when posting code that you want people to read, enclose it within the Code tabs available here to preserve the formatting.

Whether or not I would have been able to help you originally, I would not have taken the trouble to plough through your code as presented here. Others may be more patient than me, but I would not count on it.

I am not sure that I have the tone of my post right. I am not intending to be critical and am trying to point out how you might attract a better response in the future. My apologies if I come across as overly critical; this is not what I intend.

Cheers

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Coders Hangout”