NEED HELP ! i am getting SIX DIGIT number when i am trying to print OrderTotal variable

Back to topics list To post a new topic, please log in or register
avatar
10
tanim 2015.03.11 17: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);
avatar
Moderator
3419
GumRai 2015.03.11 19: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 

avatar
10
tanim 2015.03.12 04: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 

avatar
10
tanim 2015.03.12 04: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.
avatar
13006
WHRoeder 2015.03.12 13: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.
Back to topics list  

To add comments, please log in or register