Please,how put MAXORDER function in this expert ?

 

I want to limit my maximum position to 10 lot,this expert have good result in LONDON breakout period,

actualy this expert open unlimited lot until limit reached (100) with my broker.

example: (if order total>10) stop and restart (if order total<10).

the concept of the strategy is the market likely to move outside both stop order (1.3063/1.3067) in my code in breakout period,

you must set manualy stop order to update to current market price,example :@ 07:59 london time if BiD is 1.3050 put stopsell:1.3049/buystop 1.3054.

best pairs is EUR/USD GBP/USD. //NEVER USES IN CALM PERIOD//

sorry for my english

//+------------------------------------------------------------------+
//| EA_E-mail.mq4 |
//| triadinvest@yahoo.fr|
//|
//+------------------------------------------------------------------+
#property copyright "triadinvest@yahoo.fr"
#property link "itriad"

//---- input parameters
extern int TimeInterval= 1; // xx minutes to send the order
extern int lotsize = 0.001;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----


return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()

{


while(TimeInterval>0)
{
OrderSend(Symbol(), OP_BUY,lotsize,MarketInfo("EURUSD",MODE_ASK),0,1.3063,0);
OrderSend(Symbol(),OP_SELL,lotsize,MarketInfo("EURUSD",MODE_BID),0,1.3067,0);


Sleep( TimeInterval*100);//sleep in miliseconds, so use 60*1000 to change to minute
}
//----
return(0);
}
//+------------------------------------------------------------------+

 
 

please,concretely what is the code?

 
   for(int y = OrdersTotal() - 1; y >= 0; y--)
      {
      if(OrderSelect(y, SELECT_BY_POS, MODE_TRADES))
      double SumLots = SumLots + OrderLots();
      }
      if (SumLots >= 10)
         return(0);
 
qjol:


what i doing wrong?

//+------------------------------------------------------------------+
//| EA_E-mail.mq4 |
//| triadinvest@yahoo.fr|
//|
//+------------------------------------------------------------------+
#property copyright "triadinvest@yahoo.fr"
#property link "itriad"

//---- input parameters
extern int TimeInterval= 1; // xx minutes to send the order
extern int lotsize = 0.001;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----


return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()

{
for(int y = OrdersTotal() - 1; y >= 0; y--)
{
if(OrderSelect(y, SELECT_BY_POS, MODE_TRADES))
double SumLots = SumLots + OrderLots();
}
if (SumLots <= 10)
return(0);

while(TimeInterval>0)
{
OrderSend(Symbol(), OP_BUY,lotsize,MarketInfo("EURUSD",MODE_ASK),0,1.3063,0);
OrderSend(Symbol(),OP_SELL,lotsize,MarketInfo("EURUSD",MODE_BID),0,1.3067,0);


Sleep( TimeInterval*100);//sleep in miliseconds, so use 60*1000 to change to minute
}
//----
return(0);
}
//+------------------------------------------------------------------+

 

this line

if (SumLots <= 10)

should be

if (SumLots >= 10)

anyway i hope you are testing it first

 
qjol:

this line

should be

anyway i hope you are testing it first


i testing it,the same problem 100 lot opened

thanks

 

 
 

//+------------------------------------------------------------------+
//| EA_E-mail.mq4 |
//| triadinvest@yahoo.fr|
//|
//+------------------------------------------------------------------+
#property copyright "triadinvest@yahoo.fr"
#property link "itriad"

//---- input parameters
extern int TimeInterval= 1; // xx minutes to send the order
extern int lotsize = 0.001;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----


return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()

{
for(int y = OrdersTotal() - 1; y >= 0; y--)
{
if(OrderSelect(y, SELECT_BY_POS, MODE_TRADES))
double SumLots = SumLots + OrderLots();
}
if (SumLots <= 10)
return(0);

while(TimeInterval>0)
{
OrderSend(Symbol(), OP_BUY,lotsize,MarketInfo("EURUSD",MODE_ASK),0,1.3063,0);
OrderSend(Symbol(),OP_SELL,lotsize,MarketInfo("EURUSD",MODE_BID),0,1.3067,0);


Sleep( TimeInterval*1*1000);//sleep in miliseconds, so use 60*1000 to change to minute
}
//----
return(0);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                    EA_E-mail.mq4 |
//|                                              triadinvest@yahoo.fr|
//|                                         
//+------------------------------------------------------------------+
#property copyright "triadinvest@yahoo.fr"
#property link      "itriad"

//---- input parameters
extern int TimeInterval= 1;    // xx minutes to send the order
extern int lotsize     = 0.001;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
    
//----
      
   
   return(0);
  }

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()

  {
  for(int y = OrdersTotal() - 1; y >= 0; y--)
      {
      if(OrderSelect(y, SELECT_BY_POS, MODE_TRADES))
      double SumLots = SumLots + OrderLots();
      }
      if (SumLots >= 10)
         return(0);

  while(TimeInterval>0)
   {
   OrderSend(Symbol(), OP_BUY,lotsize,MarketInfo("EURUSD",MODE_ASK),0,1.3063,0); 
   OrderSend(Symbol(),OP_SELL,lotsize,MarketInfo("EURUSD",MODE_BID),0,1.3067,0);  
       
       
       Sleep( TimeInterval*1*1000);//sleep in miliseconds, so use 60*1000 to change to minute  
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
//+------------------------------------------------------------------+
//| EA_E-mail.mq4 |
//| triadinvest@yahoo.fr|
//| 
//+------------------------------------------------------------------+
#property copyright "triadinvest@yahoo.fr"
#property link "itriad"

//---- input parameters
extern int TimeInterval= 1; // xx minutes to send the order
extern int lotsize = 0.001;

double SumLots;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
for(int y = OrdersTotal() - 1; y >= 0; y--)
        {
        if(OrderSelect(y, SELECT_BY_POS, MODE_TRADES))
         SumLots = SumLots + OrderLots();
        }
if (SumLots >= 10)
return(0);


        while(TimeInterval>0)
                {
                OrderSend(Symbol(), OP_BUY,lotsize,MarketInfo("EURUSD",MODE_ASK),0,1.3063,0); 
                OrderSend(Symbol(),OP_SELL,lotsize,MarketInfo("EURUSD",MODE_BID),0,1.3067,0); 

                Sleep( TimeInterval*100);//sleep in miliseconds, so use 60*1000 to change to minute 
                }
//----
return(0);
}
//+------------------------------------------------------------------+ 

 
qjol:


stil the same problem,may be conflicting with while or sleep function?

wath dou you think of this expert?

thanks for your help