Hello,
I am trying to calculate Point Value and the code is working fine with Indicator but when i try same code with EA function it not working.
Indicator code :
Trying to convert into EA function :
Indicator Output for EURUSD : 1 Lot => 1.000 , 0.1 => 0.100 , 0.01 => 0.010
EA Function Output : 1 Lot => 1 Lot (PointValue(1)) => 1.000, 0.1 Lot (PointValue(1)) => 0.000, 0.01 Lot (PointValue(1)) => 0.000
Why it not working for EA function like Indicator?
I am trying to calculate Point Value and the code is working fine with Indicator but when i try same code with EA function it not working.
Indicator code :
MQL4:
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- string CommentString=""; string DepositCurrency=AccountInfoString(ACCOUNT_CURRENCY); double PipValue=(((MarketInfo(Symbol(),MODE_TICKVALUE)*Point)/MarketInfo(Symbol(),MODE_TICKSIZE))*LotSize); CommentString+="\n" + "Your deposit currency: " + DepositCurrency + "\n"; CommentString+="Lot size requested: " + DoubleToStr(LotSize,2) + "\n"; CommentString+="-----------------------------------------------------------------\n"; CommentString+="Value of one point (" + Symbol() + "): $" + DepositCurrency + " " + DoubleToStr(PipValue,3) + "\n"; CommentString+="-----------------------------------------------------------------\n"; Comment(CommentString); //--- return value of prev_calculated for next call return(rates_total); }
Trying to convert into EA function :
MQL4:
double PointValue(int pointvalue_lotsize) { double PointValues; PointValues = PointValue_Calculate=(((MarketInfo(Symbol(),MODE_TICKVALUE)*Point)/MarketInfo(Symbol(),MODE_TICKSIZE))*pointvalue_lotsize); return PointValues; }
Indicator Output for EURUSD : 1 Lot => 1.000 , 0.1 => 0.100 , 0.01 => 0.010
EA Function Output : 1 Lot => 1 Lot (PointValue(1)) => 1.000, 0.1 Lot (PointValue(1)) => 0.000, 0.01 Lot (PointValue(1)) => 0.000
Why it not working for EA function like Indicator?