MQL4 - automated forex trading   /  

Forum

Limiting The Number of Trades per bar

Back to topics list To post a new topic, please log in or register

avatar
11
zecco 2008.06.02 18:55 

Dear Fellow Traders

Please, how do I ensure that in an EA, not more than N number of trades is opened in a single bar once my set of conditions is met.

Thank you all for your ealier replies. Rosh, Thanks a lot for those helpuful answers.

article

Interview with Michael Bullock (Zonker)

Constantly plowing back all the profit and scaling up the position is pure suicide trading on a real account. But that is not relevant, this is a competition, over 250 competitors, and only three walk away with anything. You do whatever it takes to maximize your chances to be in that Top Three. I'm not sure you can talk about risk in the context of the competition, risk implies you might lose something, but here there is only a chance to gain for those who beat the odds.


avatar
1227
BarrowBoy 2008.06.03 13:02 

Use something like this to count the open orders

Then dont open any more :)

--

int OpenTradesForMagicNumber(string SymbolToCheck, int MagicNumberToCheck)
{
int icnt, itotal, retval;

retval=0;
itotal=OrdersTotal();

   for(icnt=0;icnt<itotal;icnt++)
     {
      OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES);
       // check for opened position, symbol & MagicNumber
      if(OrderType()<=OP_SELL && OrderSymbol()==SymbolToCheck  && OrderMagicNumber()==MagicNumberToCheck)  
        {
        
        retval++;
        
        //Print("Orders opened : ",retval);
        
        }
     }

return(retval);
}

Good Luck

-BB-

Back to topics list  

To add comments, please log in or register