# Calculation assistance

247

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 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);

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);
HILO = DoubleToStr((High_Today-Low_Today)/Point,0);
MAVV = (DoubleToStr(MAv,Digits));

"\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));

//---
```
Moderator
10569

`      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.
247

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

15582

Your statement and your image does does not make sense. 1.109078 - 1.08896 = 0.020118 not 182.