I have reported this before but upon further inspection it is quite definitely a bug.
In your templates (tpl) files you store the symbol and digits (e.g. symbol=USDJPY, digits=2). When applying the template to a chart with different point (e.g. EURUSD) size the Point and Digit variables seem to be set from the template (e.g. EURUSD then uses Point=0.01 / Digits=2 rather than 0.0001 and 4). MarketInfo() however gets correct results for both.
Here is a code snippet from the init() function and it's output (note the different values for Point and MODE_POINT and Digits and MODE_DIGITS in the output snippet below).
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
In your templates (tpl) files you store the symbol and digits (e.g. symbol=USDJPY, digits=2). When applying the template to a chart with different point (e.g. EURUSD) size the Point and Digit variables seem to be set from the template (e.g. EURUSD then uses Point=0.01 / Digits=2 rather than 0.0001 and 4). MarketInfo() however gets correct results for both.
Here is a code snippet from the init() function and it's output (note the different values for Point and MODE_POINT and Digits and MODE_DIGITS in the output snippet below).
bool jpy= StringFind(Symbol(), "JPY")!=-1, index= StringGetChar(Symbol(), 0)=='_', stock= StringGetChar(Symbol(), 0)=='#', forex= !index && !stock; if ((jpy && Point!=0.01) || ((!jpy && forex) && Point!=0.0001)) { Alert("[Bunnygirl] Internal Error: Incorrect Pip Size for " + Symbol() + " ("+ DoubleToStr(Point,4)+"/"+Digits+")"); Print(Point, " ", Digits, " ", MarketInfo(Symbol(), MODE_POINT), " ", MarketInfo(Symbol(), MODE_DIGITS), " ", MarketInfo(Symbol(), MODE_TICKSIZE), " "); }2005.11.04 22:56:03 SDX-Bunnygirl EURUSD,H1: Alert: [Bunnygirl] Internal Error: Incorrect Pip Size for EURUSD (0.0100/2)
2005.11.04 22:56:03 SDX-Bunnygirl EURUSD,H1: 0.01 2 0.0001 4 0
This is the upper part of the tpl file. If I change digits=2 into digits=4 I can apply the template to an EURUSD chart with correct results.
<chart>
symbol=USDJPY
period=15
leftpos=19067
digits=2
scale=8
graph=0
fore=0
grid=0
volume=0
scroll=0
shift=1
ohlc=1
askline=1
days=0
descriptions=0
shift_size=20
fixed_pos=0
window_left=0
window_top=0
window_right=735
window_bottom=404
window_type=3
background_color=0
foreground_color=16777215
barup_color=11119017
bardown_color=11119017
bullcandle_color=11119017
bearcandle_color=11119017
chartline_color=11119017
volumes_color=3329330
grid_color=3158064
askline_color=3158064
stops_color=0
This is build 184, Oct.24th
A fix would be highly appreciated.
Markus