When does it make sense to keep part of the robot code in an indicator? - page 24
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
I gave the logic of a workable algorithm. It didn't work. I'm sorry I didn't get through.
You tell me the error in the code, not your vision of the correct algorithm. You say there's an error. Then you know exactly where it is located. Why is it so hard to show the location (which you have already defined) in 10 lines of code?
No, the price will already be on a new bar. This is perfectly visible when the terminal is switched on. In the beginning the bar looks like a point.
I told you about the REAL conditions. An EA with an indicator will also get an incorrect EMA value as long as there are no bars.
If we are talking about REAL conditions of adequate use of the EA, then the gap of 10 minutes will absolutely be taken into account.
You point out the error in the code to me, not your vision of the correct algorithm. You say there is an error. So you know exactly where it is located. Why is it so hard to show you the location (which you have already defined) in 10 lines of code?
You cannot operate with time. You can only operate with the number of current bars and the number of bars processed. If their difference is greater than 1, then full recalculation. If it is equal to 1, calculation of the first and the second bar. If it is equal to zero, then only the zero bar.
There is nothing complicated about it. I just repeated the algorithm for the correct calculation. I don't want to give you the calculation itself. There is no sense in it. If there is no desire to try to do such a thing, then there is no need. And there is no sense in discussing it any further.
I told you about the REAL conditions. An EA with an indicator will get exactly the same incorrect EMA value as long as there are no bars.
You can't operate on time. You can only operate on the number of current bars and the number of bars processed. If their difference is greater than 1, then full recalculation. If it is equal to 1, then the calculation of the first and the second bar. If equal to zero, then only the zero bar.
I don't understand what you are saying, about not being allowed. I gave you a specific example with a disconnect. In this example, I have shown you that the calculation will be correct. What's not to like? I showed you an example, I showed you that the gap will be taken into account. But now you are saying that it cannot be done that way. The result is correct, but you say you can't.
Yes, but while the values in the indicator will correct as soon as the bars come in, in your version the values will be wrong for the number of bars equal to the width of the EMA window.
P.S. About the IndicatorCounted() implementation. In MT4 there are no buffers keeping track of it. There is just a hash function whose value is indirectly used in IndicatorCounted(). Whenever the history is changed, the hash function changes the value. Anyone can write a simple hash function that will track changes in the history.
Cut the crap.
Learn how to argue.
I'm sorry, but explaining anything to you is a very unfortunate task.
So I bid you farewell with a brush...
And by the way, where's your promised version of the Expert Advisor to be hooked up to the indicator? I can't find it anywhere.
The discussion goes in the wrong direction because the problem of connection and history swapping is not discussed here, but performance measurement of any random input data through the indicator and directly in the code.