
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
While I was shopping both perfectly working indicators Mom and Sma suddenly stop working:
There is nothing in the journal log, excerpt that Sma was installed at 9:00 and at 19: a ping failed (Chart is GMT my pc has GMT+1):
2017.08.04 09:14:15.550 Custom indicator Test_OOP_Sma EURUSD,H1: loaded successfully
Before the 17:00-bar (since installation) and again right after I opened the setup box and pressed OK both indicators show this image on the chart:
I solved the problem.
Occasionally mt4 (and mt5?) sets the variable prev_calculated (of OnCalculate(..)) to 0.
So to keep the objects clean and lean I had to do (for indicators):
Hopefully I will not be caught in an endless loop :(I solved the problem.
Occasionally mt4 (and mt5?) sets the variable prev_calculated (of OnCalculate(..)) to 0.
Normal behaviour when there is a chart refresh, chart shifted or whaetever reason.
So to keep the objects clean and lean I had to do (for indicators):
Hopefully I will not be caught in an endless loop :(Seems to me a bad idea to call directly OnDeinit() and OnInit() from OnCalculate(), you are preparing future headache.
I can't propose something else though as I don't understand your problem from the snippets of code you posted.
Normal behaviour when there is a chart refresh, chart shifted or whaetever reason.
Seems to me a bad idea to call directly OnDeinit() and OnInit() from OnCalculate(), you are preparing future headache.
I can't propose something else though as I don't understand your problem from the snippets of code you posted.
As you said "whatever reason" which means you'll never know or can control it :(
Seems to me a bad idea to call directly OnDeinit() and OnInit() from OnCalculate(), you are preparing future headache.
Well I have two options:
The second option seems to me the better one.
As you said "whatever reason" which means you'll never know or can control it :(
Well I have two options:
The second option seems to me the better one.
As you wish.
But you don't have to control it. Either prev_calculated is =0 that means you have to rebuild all (if needed), or it's prev_calculated=rates_total (more or less) and you just have to update 1 or a few candles.
If you can't deal with that, your architecture is seriously flawed. Only my opinion and it's always possible I misunderstood your issue.