Download MetaTrader 5

Calculation assistance

To add comments, please log in or register
fxtrader_
247
fxtrader_  

Hi all,


In the below code I'm try to ( subtract A Value From High in the 0 bar ) , can any help please.


 //----
   double MAv = iMA( NULL, 0, 13, 0, 0, 0, 0);
 
   double spread = MarketInfo (Symbol(), MODE_SPREAD);
   double minlot = MarketInfo (Symbol(), MODE_MINLOT);
   double maxlot = MarketInfo (Symbol(), MODE_MAXLOT);
   double step = MarketInfo (Symbol(), MODE_LOTSTEP);
   double margin = MarketInfo (Symbol(), MODE_MARGINREQUIRED);
   double leverage = NormalizeDouble ((Bid/(margin/100))*1000,0);


     string SPREAD="",PIPS="",HILO="", MAVV="";
     
      double OPEN = iOpen(NULL,0,0);
      double CLOSE = iClose(NULL,0,0);
      double SPRD = (Ask - Bid)/Point;
      double High_Today = iHigh(NULL,0,0);
      double Low_Today = iLow(NULL,0,0);
      
         PIPS =  DoubleToStr((CLOSE-OPEN)/Point,0);
         SPREAD = (DoubleToStr(SPRD,Digits-4));
         HILO = DoubleToStr((High_Today-Low_Today)/Point,0);
         MAVV = (DoubleToStr(MAv,Digits));
         
         
         
      Comment( "SPREAD "+DoubleToStr(SPRD/10,1),""
         "\n", "PIPS TO OPEN "+PIPS,""
         "\n", "Hi TO Low "+HILO,""
         "\n", "MIN LOT "+minlot,""
         "\n", "MAX LOT "+maxlot,""
         "\n", "STEP "+step,""
         "\n", "MA 13  "+MAVV,""
         "\n", "CLOSE "+CLOSE,""
         "\n",                                   // here i need the subtracted results  ( MAVV - High_Today)
                                                 // if price ballow MA or Low_Today if price above MA )
         
         "\n", "MARGIN "+DoubleToStr(margin/100,2));
         

//---
Keith Watford
Moderator
9988
Keith Watford  
      double High_Today = iHigh(NULL,0,0);
will only get today's high if it is attached to the D1 chart. Otherwise it will get the high of the current chart time-frame.
fxtrader_
247
fxtrader_  

Tha above coe work with any time frame, BUT i'n not able to do the math for subtract.



whroeder1
15027
whroeder1  
Your statement and your image does does not make sense. 1.109078 - 1.08896 = 0.020118 not 182.
To add comments, please log in or register