Open multiple trades, One per pair. (I can't figure out how to code it)

To add comments, please log in or register
fly2hi
68
fly2hi  

Currently, I have been using this code...

//-------------------------------------------------------------------

int TotalOrdersCount()

{

  int result=0;

  for(int i=0;i<OrdersTotal();i++)

  {

     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

     if (OrderMagicNumber()==MagicNumber) result++;

//------------------------------------------------------------------

it has worked fine, all I do is switch magic numbers for each currency pair. But I'm improving my EAs but I don't know how to write it.

I want my EA to open different trades on different pairs, but only one per pair. How do I do it?

Marco vd Heijden
Moderator
8634
Marco vd Heijden  

There is no ordersend in your code.

If you want to open orders on different pairs you can use SymbolName(pos,1)

fly2hi
68
fly2hi  
this isn't my entire code Marco, it's just the portion that regulates how many trades are placed at a time...
Marco vd Heijden
Moderator
8634
Marco vd Heijden  

Maybe it's a good idea to post all code.

This code only increments result whenever a magic number match appears.

If you want your EA to trade multiple pairs (again) you can use SymbolName(pos,1)

To add comments, please log in or register