
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
If new history arrives, any remember Bars or previous Bars will be misleading.
There have never been any problems with this in MT4:
Forum on trading, automated trading systems and testing trading strategies
Include a personalized indicator in an Expert Advisor
Vladislav Boyko, 2024.03.31 18:58
If the difference between "rates_total" and "prev_calculated" is not equal to 0 and not equal to 1, then recalculate all indicator values. If this happens, it is very rare (I add a message to the experts’ journal when calculating indicators “from scratch”)
Forum on trading, automated trading systems and testing trading strategies
Include a personalized indicator in an Expert Advisor
Vladislav Boyko, 2024.04.01 01:50
This is not difficult to implement in MT4. Below is the method code of one of my old advisors. Think of it as pseudocode
This method controls the sizes of buffers and returns rates_total and prev_calculated
But I don't really like this implementation (it's quite old). This is the first thing I found right now. I remember that I had better implementations, but I deleted them after the customer confirmed that they worked correctly.
Therefore, I emphasize once again: take this as pseudocode
Forum on trading, automated trading systems and testing trading strategies
Include a personalized indicator in an Expert Advisor
Vladislav Boyko, 2024.04.01 01:50
This doesn't look good because the return value of this function is not checked. I remember that I simply changed my mind about checking it, since in the case of ArraySetAsSeries, if the error did not occur during the first test, then it will definitely never occur.
I would like to hear how you think about this solution:
If a history update or refresh, adds bars to history, how do you detect it and reset prev_calculated to zero or recompute all bars?
If the terminal adds bars to the history, then notCalculated will be greater than 1, which will lead to the recalculation of all indicator values. I don't think the terminal will only add 1 bar when loading history.
Forum on trading, automated trading systems and testing trading strategies
Include a personalized indicator in an Expert Advisor
Vladislav Boyko, 2024.04.01 01:50
Why are you writing nineteen (19) lines above, instead of just a single iCustom call?
It requires a lot more lines than 19😄