Hi All,
I've been trying to backtest my EA with TickStory but the backtest last about 1msec and the journal reports the following error:
2015.01.01 22:00:01 jim_h smadistance 1.00 EURNZD,Daily: zero divide in 'jim_h smadistance 1.00.mq4' (114,27)
2015.01.01 22:01:27 jim_h smadistance 1.00 GBPJPY,Daily: zero divide in 'jim_h smadistance 1.00.mq4' (114,27)
2012.08.05 00:00:00 jim_h smadistance 1.00 SPX500,Daily: zero divide in 'jim_h smadistance 1.00.mq4' (114,27)
However this EA works fine, I've been running it successfuly on the symbols above for weeks now without issue, I just want to optimize it for different symbols using Tickstory.
Any ideas would be greatly appreciated.
Thanks
Jim
Critical Error EA (zero divide)
Re: Critical Error EA (zero divide)
Hi Jim,
If you have the source code for the EA, you will need to check the line causing the issue (i.e. #114). It could have something to do with the amount of data you exported (eg. it's trying to reference the last 30 days of data but you've only exported 20) or it's simply a bug in the code that needs to be fixed.
Hope this helps.
If you have the source code for the EA, you will need to check the line causing the issue (i.e. #114). It could have something to do with the amount of data you exported (eg. it's trying to reference the last 30 days of data but you've only exported 20) or it's simply a bug in the code that needs to be fixed.
Hope this helps.
-
- Posts: 3
- Joined: Sun Oct 20, 2019 6:31 pm
Re: Critical Error EA (zero divide)
Hi
Thanks for the reply I should point out that until yesterday I was able to run Tickstory with this EA, I have downloaded last 5 years data and I selected a 12 month period within that data set to run the back test.
Jim
Thanks for the reply I should point out that until yesterday I was able to run Tickstory with this EA, I have downloaded last 5 years data and I selected a 12 month period within that data set to run the back test.
Jim
Re: Critical Error EA (zero divide)
Hi Jim,
It could have something to do with the size of the data you exported. You can try vary your exported dates to see if that resolves it, however the line in the code will give you the definitive answer as there is clearly an error in some particular scenario.
Hope this helps.
It could have something to do with the size of the data you exported. You can try vary your exported dates to see if that resolves it, however the line in the code will give you the definitive answer as there is clearly an error in some particular scenario.
Hope this helps.
-
- Posts: 3
- Joined: Sun Oct 20, 2019 6:31 pm
Re: Critical Error EA (zero divide)
Hi,
I'm still not sure why I am getting the error, below are lines 113 and 114 of the EA
double ma1_0=iMA(NULL,0,MA_Period,MA_Shift,MA_Method,MA_ApplyTo,0);
double price_ratio=Bid/ma1_0;
Any ideas?
Thanks
Jim
I'm still not sure why I am getting the error, below are lines 113 and 114 of the EA
double ma1_0=iMA(NULL,0,MA_Period,MA_Shift,MA_Method,MA_ApplyTo,0);
double price_ratio=Bid/ma1_0;
Any ideas?
Thanks
Jim
Re: Critical Error EA (zero divide)
Hi Jim,
Unfortunately we can't help you debug the EA as it's out-of-scope of the support we can provide.
As a courtesy, what I can gather from the information given so far is that the "ma1_0" variable is coming out as zero. You will need to do some extra debugging to find out the values of the parameters being passed in to iMA (MA_Period, etc). Maybe it's as simple as changing a parameter in your EA? If it was working before, I would be inclined to re-export a smaller amount of data to test (i.e. make sure you have enough bars to calculate the desired moving average).
Here are some additional links that may help:
https://docs.mql4.com/indicators/ima
https://www.mql5.com/en/forum/158547
https://www.mql5.com/en/forum/231167/page2
We will leave this discussion open in case other users may have further information to contribute.
Thanks.
Unfortunately we can't help you debug the EA as it's out-of-scope of the support we can provide.
As a courtesy, what I can gather from the information given so far is that the "ma1_0" variable is coming out as zero. You will need to do some extra debugging to find out the values of the parameters being passed in to iMA (MA_Period, etc). Maybe it's as simple as changing a parameter in your EA? If it was working before, I would be inclined to re-export a smaller amount of data to test (i.e. make sure you have enough bars to calculate the desired moving average).
Here are some additional links that may help:
https://docs.mql4.com/indicators/ima
https://www.mql5.com/en/forum/158547
https://www.mql5.com/en/forum/231167/page2
We will leave this discussion open in case other users may have further information to contribute.
Thanks.