Trying to get iATR from MT4, value appears wrong by at least a factor of 10, how to auto-correct please.
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");
double atrh = iATR(NULL,1,120,0)*10;
Do you intend to get the ATR for the M1 time-frame?
1 hour time frame, so 120 equals 1 trading week.
Your iATR call is for the M1 time-frame.