Download MetaTrader 5
To add comments, please log in or register
Hundreds of articles will help you to create a trading robot. Come and read them!
tofazzle
37
tofazzle 2015.03.11 16:21 
Hello guys,hope you are having a good day.I am trying co compare Previous OrderTotal with current Open OrderTotal in a EA.I decleared them as global int variable and set as zero.but when i am trying to print them i am getting SIX DIGIT number which is not possible.can anyone has explanation for that
 
 int   Total1=0;
 int   Total11=0;
 int   Total2=0;
 int   Total22=0;//global var



for (i = OrdersTotal () - 1; i >= 0; i --)  
  { 
   if (OrderSelect (i, SELECT_BY_POS,MODE_TRADES))
     {
       if (OrderMagicNumber () >= initial_magic1 && OrderMagicNumber () <= initial_magic1 + 100)
         {
           
           if(OrderType()== OP_BUY)
            {Total11++;Print("Dipa");}
            
            
           if(OrderType()== OP_SELL)
            {Total11++;}
            
         }
       if (OrderMagicNumber () >= initial_magic2 && OrderMagicNumber () <= initial_magic2 + 100)
         {
            switch(OrderType())
            {case OP_BUY:
            Total22++;
            break;
            
            case OP_SELL:
            Total22++;
            break;} 
           
         }
      }
    }
    Print("a====",Total1);
    Print("b====",Total11);
    Print("ceTT====",Total2);
    Print("banMMO====",Total22);
Keith Watford
Moderator
7906
Keith Watford 2015.03.11 18:11  

What do you mean by 6 digits?

6 digits after a decimal point or 100,000 plus?

Your globally declared variables need to be re-set to zero every tick 

tofazzle
37
tofazzle 2015.03.12 03:00  
GumRai:

What do you mean by 6 digits?

6 digits after a decimal point or 100,000 plus?

Your globally declared variables need to be re-set to zero every tick 

tofazzle
37
tofazzle 2015.03.12 03:12  
100,000 plus not decimal point as orderTotal is an int.no i cant reset it zero,because I need to compare them .if (Current orderTotal<Previouse Order total){do something}.note : I updated the Previous with current like this Total1=Total11 which forgot to mention in HRC code.
whroeder1
13610
whroeder1 2015.03.12 12:33  
tanim:  i cant reset it zero,because I need to compare them
  1. First tick after opening, you increment by 1 (assuming one open order.) Next tick you again increment by 1 = 2. 100th tick you now have 100. 1000th tick you have 1000.
  2. you must reset them if you want to compare.
/
To add comments, please log in or register