Profit_Warning:
The following code runs properly when the strategy is attached to a chart (GBPUSD pair)
But when I bastest it, i receive the error Zero divide in the line:
because MarketInfo ("EURGBP", MODE_ASK) is equal to 0.
Tester can be used for one symbol only -> https://www.mql5.com/en/articles/1512. The following code runs properly when the strategy is attached to a chart (GBPUSD pair)
But when I bastest it, i receive the error Zero divide in the line:
because MarketInfo ("EURGBP", MODE_ASK) is equal to 0.
If all you need is the Ask price of another currency, you can have the expert search for it in the hst files (via File functions).
gordon:
Tester can be used for one symbol only -> https://www.mql5.com/en/articles/1512.
If all you need is the Ask price of another currency, you can have the expert search for it in the hst files (via File functions).
Tester can be used for one symbol only -> https://www.mql5.com/en/articles/1512.
If all you need is the Ask price of another currency, you can have the expert search for it in the hst files (via File functions).
Also if the symbol does not end in your account currency then pip_value will not be in your account currency and the equation with AccountBalance() will be bogus.
pip_value = MarketInfo( Symbol(), MODE_TICKVALUE );Finally on a 5 digit broker a pip is NOT a point
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init() { if (Digits == 5 || Digits == 3) { // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; }
WHRoeder:
Also if the symbol does not end in your account currency then pip_value will not be in your account currency and the equation with AccountBalance() will be bogus. Finally on a 5 digit broker a pip is NOT a point
Also if the symbol does not end in your account currency then pip_value will not be in your account currency and the equation with AccountBalance() will be bogus. Finally on a 5 digit broker a pip is NOT a point
Thanks WHRoeder,
My account is in EUR, so I had to operate a little bit. Point (=0.00001)*100.000/ASK(GBPUSD) give the the value of a point (a change of 1 lot in 0.00001) in GBP. To get the value in my account currency, EUR, I have to convert this value to EUR just dividing the previous value by the ASK(EURGBP).
And it's at that point, getting the ASK (EURGPB) value where I had problems.
Thans for your code.
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
here the problem I've being fighting against.
The following code runs properly when the strategy is attached to a chart (GBPUSD pair)
But when I bastest it, i receive the error Zero divide in the line:
because MarketInfo ("EURGBP", MODE_ASK) is equal to 0.
I've downloaded all historical data with no changes.
Any idea how to get access to this information from the GBPUSD chart in backtesting? Can MT do it anyway?
Thank you in advance