Problem: pip count (MQL4)

To add comments, please log in or register
gehtdoch
52
gehtdoch  

Hi, can someone clear the error to me. I do not find him. Except for the pips all other values are counted correctly. Thanks in advance.

   double ProfitToday=0,ProfitYesterday=0,ProfitToday1=0,ProfitYesterday1=0;
   int YesterdayTrades=0,TodayTrades=0,YesterdayTrades1=0,TodayTrades1=0,FirstOnly=0;
   double pips0=0,pips1=0,pips2=0,pips00,pips01,pips02;
   double Faktor;
   int Is_DAX=0, Is_DJI=0, Is_JPY=0, Is_EUUS=0, Is_GBUS=0;
   string Paar;
//-----------------------------------
   for(h=OrdersHistoryTotal()-1;h>=0;h--) // Schleife
     {
      Paar=OrderSymbol();

      if(OrderSelect(h,SELECT_BY_POS,MODE_HISTORY)==true && OrderSymbol()==Symbol()) // Anzahl Trades, pips, Profit heute bei diesem Symbol
       {
         Faktor=0;
         Is_DAX=StringFind(Paar,"DAX",0);
          if(Is_DAX==-1) Faktor=Point*A1;
         Is_DJI=StringFind(Paar,"DJI",0);
          if(Is_DJI==-1) Faktor=Point*B1;                 
         Is_JPY=StringFind(Paar,"JPY",0);
          if(Is_JPY==-1) Faktor=Point*C1;
//         Is_EUUS=StringFind(Paar,"EURUSD",0);
//          if(Is_EUUS==-1) Faktor=Point*100;
//         Is_GBUS=StringFind(Paar,"GBPUSD",0);
//          if(Is_GBUS==-1) Faktor=Point*10;
         else Faktor=Point*D1;
          
         if(OrderCloseTime()>YesterdayStart)
           {        

            if(OrderCloseTime()>YesterdayEnd){ ProfitToday=ProfitToday+OrderProfit(); TodayTrades++;        
             if  (OrderType()== OP_BUY) pips0=pips0+ ((OrderClosePrice()-OrderOpenPrice())/Faktor); 
             if  (OrderType()== OP_SELL) pips0=pips0+((OrderOpenPrice()-OrderClosePrice())/Faktor);
             pips00 = DoubleToStr(pips0,2);}
           }             
        }//Ende Select

      if(OrderSelect(h,SELECT_BY_POS,MODE_HISTORY)==true) // Alle Trades heute, gestern, pips und Profit
        {
         Faktor=0;
         Is_DAX=StringFind(Paar,"DAX",0);
          if(Is_DAX==-1) Faktor=Point*A1; //A1 = 1
         Is_DJI=StringFind(Paar,"DJI",0);
          if(Is_DJI==-1) Faktor=Point*A1;                 
         Is_JPY=StringFind(Paar,"JPY",0);
          if(Is_JPY==-1) Faktor=Point*B1; //B1 = 10
         //else Faktor=Point*D1;            //D1 = 1000
         
         if(OrderCloseTime()>YesterdayStart)
           {        

            if(OrderCloseTime()>YesterdayEnd){ ProfitToday1=ProfitToday1+OrderProfit(); TodayTrades1++;        
             if  (OrderType()== OP_BUY)  pips1=pips1+((OrderClosePrice()-OrderOpenPrice())/Faktor);  
             if  (OrderType()== OP_SELL) pips1=pips1+((OrderOpenPrice()-OrderClosePrice())/Faktor);
              pips01 = DoubleToStr(pips1,2);}
            
            if(OrderCloseTime()<YesterdayEnd && OrderCloseTime()>YesterdayStart){ ProfitYesterday1=ProfitYesterday1+OrderProfit(); YesterdayTrades1++;
             if  (OrderType()== OP_BUY)  pips2=pips2+((OrderClosePrice()-OrderOpenPrice())/Faktor); 
             if  (OrderType()== OP_SELL) pips2=pips2+((OrderOpenPrice()-OrderClosePrice())/Faktor); 
              pips02 = DoubleToStr(pips2,2);}
           
           } 
        }//Ende Select
     } //Ende TradeSelection

   string eanameParameters=StringConcatenate("","Deals hier: ",TodayTrades,"");
   ObjectSetText("Label_deals1",eanameParameters,8,"Arial",Blue);
   string eanameParameters1=StringConcatenate("","Profit: ",ProfitToday," €");
   ObjectSetText("Label_profit1",eanameParameters1,8,"Arial",Blue);
   string eanameParameters2=StringConcatenate("","Pips: ",pips00,"");
   ObjectSetText("Label_pips0",eanameParameters2,8,"Arial",Blue);
   
   string eanameParameters3=StringConcatenate("","Deals Vortag: ",YesterdayTrades1,"");
   ObjectSetText("Label_deals2",eanameParameters3,8,"Arial",Black);
   string eanameParameters4=StringConcatenate("","Profit: ",ProfitYesterday1," €");
   ObjectSetText("Label_profit2",eanameParameters4,8,"Arial",Black);
   string eanameParameters5=StringConcatenate("","Pips: ",pips02,"");
   ObjectSetText("Label_pips2",eanameParameters5,8,"Arial",Black);
   
   string eanameParameters6=StringConcatenate("","Deals heute: ",TodayTrades1,"");
   ObjectSetText("Label_yesterdayall",eanameParameters6,8,"Arial",Green);
   string eanameParameters7=StringConcatenate("","Profit: ",ProfitToday1," €");
   ObjectSetText("Label_yallprofit",eanameParameters7,8,"Arial",Green);
   string eanameParameters8=StringConcatenate("","Pips: ",pips01,"");
   ObjectSetText("Label_pips1",eanameParameters8,8,"Arial",Green);


gehtdoch
52
gehtdoch  
Hi, to all who tried to help me with my problem. I am very grateful and would like to say Communication: The problem I have solved itself. I wish a merry Christmas.
To add comments, please log in or register