![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Trying to get iATR from MT4, value appears wrong by at least a factor of 10, how to auto-correct please.
Code is:
double spread = MarketInfo(Symbol(),MODE_SPREAD);
double minlot = MarketInfo(Symbol(),MODE_MINLOT);
double lotstep = MarketInfo(Symbol(),MODE_LOTSTEP);
double margin = MarketInfo(Symbol(),MODE_MARGINREQUIRED);
double leverage = NormalizeDouble((Bid/(margin/100))*1000,0);
double atrh = iATR(NULL,1,120,0)*10; //Note: The *10 is an adjustment to get closer to the actual ATR which MT4 "iATR" does not seem to calculate correctly!!
MessageBox("The spread on this pair is "+DoubleToStr(spread/10,1)+" pips"
"\nThe smallest lot-size is "+DoubleToStr(minlot,2)+
"\nThe lot-step is "+DoubleToStr(lotstep,2)+
"\nThe margin required per contract is "+DoubleToStr(margin,0)+
"\nand the leverage is "+DoubleToStr(leverage,0)+":1"+
"\nThe ATR is approximately "+DoubleToStr(atrh,4)
,Period()+"M "+Symbol()+" Currency pair - Info");
Thanks!