![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
@nicholishen
So it's more complex than we thought. It depends of the hardware and the exact tests run.
Anyway for the way you lead this discussion you deserve your ban.
Actually I can not ban me otherwise I will do...loool
So I changed my mind and removed the ban.
All this topic is a big lesson, hopefully.
On the technical aspects, we all had a part right and a part wrong, but we could not communicate quietly.
We have all a part in this clash and it's a pity. I hope every participant will learn from it. I will for sure.
This topic is quite important for me, and in light of recent posts, I've decide to start fresh and look at every point once again.
However, I am going to take some time to code my own tests from scratch for various situations, so that I can see for myself in detail what is going on and whether I can confirm or deny what has been stated so far.
Lets start fresh, putting aside animosities and taking a look at things once more, slowly and steadily!
Actually I can not ban me otherwise I will do...loool
So I changed my mind and removed the ban.
All this topic is a big lesson, hopefully.
On the technical aspects, we all had a part right and a part wrong, but we could not communicate quietly.
We have all a part in this clash and it's a pity. I hope every participant will learn from it. I will for sure.
@Alain Verleyen, I would like to request that you split off this thread from the original OP's query, because that got answered right at the beginning and the rest of the discussion is really one big long off-topic subject all on its own.
Maybe you can call the thread - "Which is faster - Floating-Point or Integer arithmetic?"
I ask this, because I would like to continue the discussion, but hopefully all parties will cool down and be more calm about it.
@Alain Verleyen, I would like to request that you split off this thread from the original OP's query, because that got answered right at the beginning and the rest of the discussion is really one big long off-topic subject all on its own.
Maybe you can call the thread - "Which is faster - Floating-Point or Integer arithmetic?"
I ask this, because I would like to continue the discussion, but hopefully all parties will cool down and be more calm about it.
Done.
So....
My intention is to start from the beginning, with fresh eyes and follow a slow, step-by-step, more rigorous approach to analysing the issue, giving credit to each party where due, because it appears that all parties were both right and wrong in their assumptions and conclusions, contributing with both constructive and destructive information. So lets start fresh and redo things, collaborating to achieve a common goal instead of fighting among ourselves.
I am currently analysing each and every point that was discussed here so far, as well as every test code used and results shown (by all parties). So far, in my testing, some results favour Integer Arithmetic as faster while in other tests it favours Floating-point as being faster and I want to understand why that is and in what circumstances these differences occur. I don’t just want academic theoretical information, but actual usable information, that will help make EAs faster according to whatever is found to be valid for each situation.
@whroeder1 reminded us of the CPU/FPU situation, but I want to take it further and look at different hardware scenarios and what impact they have, as well as the differences between MT4 and MT5. I am also looking into known standardised benchmark tests in order to port them to MQL code for more rigorous analysis.
However, due to other prior commitments, I will not be able to focus 100% on this task with-in the next couple of days! @Alain Verleyen too is busy at the moment, so I ask that we pursue this issue more intensely from Thursday onward, so that we can all participate in a combined effort and not as separate individuals.
I also searched the Internet for similar situations in other languages, and found the following articles to be of interest which we can also discuss once we are all back here working together on this:
Should anyone find other such related articles, please post a link here so that we can use the information in analysing what impact they have on MQL.
I re-post the modified code (original code from @nicholishen), I just added some code to use the result of the addition num1+num2
Then I ran it with 1E7 and 1E8 iterations and I got results which I can't explain. As said by @Fernando Carreiro, I don't have much time this week, so I will be happy if someone can provide some light about this.
2018.01.15 23:06:28.776 224626_2 (NZDUSD,H1) <int>: 98 ms for 10000000 iterations
2018.01.15 23:06:28.776 224626_2 (NZDUSD,H1) result = 9981256 sum=327648917016
2018.01.15 23:06:28.858 224626_2 (NZDUSD,H1) <double>: 81 ms for 10000000 iterations
2018.01.15 23:06:28.858 224626_2 (NZDUSD,H1) result = 9981256 sum=327648917016.000000
2018.01.15 23:07:30.459 224626_2 (NZDUSD,H1) <int>: 7078 ms for 100000000 iterations
2018.01.15 23:07:30.462 224626_2 (NZDUSD,H1) result = 99813298 sum=3276567693470
2018.01.15 23:07:43.736 224626_2 (NZDUSD,H1) <double>: 13271 ms for 100000000 iterations
2018.01.15 23:07:43.738 224626_2 (NZDUSD,H1) result = 99813298 sum=3276567693470.000000
You an also notice that the above results are quite different from the ones I posted earlier today (I just run the same unchanged script, except 1E7/1E8 iterations):
2018.01.15 10:43:44.698 224626_2 (EURUSD,M1) <int>: 3164 ms for 100000000 iterations
2018.01.15 10:43:44.702 224626_2 (EURUSD,M1) result = 99813497 sum=3276606316406
2018.01.15 10:44:24.734 224626_2 (EURUSD,M1) <double>: 40028 ms for 100000000 iterations
2018.01.15 10:44:24.736 224626_2 (EURUSD,M1) result = 99813497 sum=3276606316406.000000
It's the same computer, Windows 10 notebook (5 years-old), intel i7-2677M 1.80 GHz 4GB RAM. MT5 1745/64. Of course I have a lot of software running, so it's academic results for sure.
I re-post the modified code (original code from @nicholishen), I just added some code to use the result of the addition num1+num2
Then I ran it with 1E7 and 1E8 iterations and I got results which I can't explain. As said by Fernando, I don't have much time this week, so I will be happy if someone can provide some light about this.
It's the same computer, Windows 10 notebook (5 years-old), intel i7-2677M 1.80 GHz 4GB RAM. MT5 1745/64. Of course I have a lot of software running, so it's academic results for sure.
In contrast, here are the results on my machine (MTv5 build 1745 x64, Windows 10 build 16299 x64, Intel Core i7-4790T @ 2.70GHz, 16GB RAM, 960GB SSD Disk):
EDIT: from these two sets of results, @Alain Verleyen and my own, I repeat the following statement which applies to this case:
@nicholishen, can you run these same tests on your machine please and post the results you get (as well as your hardware configuration)?
EDIT2: And here are the results for the MT4 adaptation (MTv4 build 1090, same PC as above):
Can anyone shed some light on whether this subject has ever been discussed before on the Russian forum?
They tend to go much more in-depth into situations than we do here on the English one!
Alain, not sure how you got those results... I'm right where Fernando is on a 2.4 GHz i5.
Fernando, thanks for also running these on MT4...that answers that for me...
06:28:13.706 224626_2__1 (EURUSD,H1) <int>: 27 ms for 10000000 iterations
06:28:13.706 224626_2__1 (EURUSD,H1) result = 9981267 sum=327684089175
06:28:13.731 224626_2__1 (EURUSD,H1) <double>: 24 ms for 10000000 iterations
06:28:13.731 224626_2__1 (EURUSD,H1) result = 9981267 sum=327684089175.000000
Surprisingly, array read/write/sort performance is the same as well. That's where I thought <int> might have a more significant edge.