The problem seems to be OnCalculate is called before the initiation of indicator in OnInit finishes.
But solution I do not know what can be.
I tried putting initiation line in OnCalculate but it didn't help.
Also I tried calling OnCalculate several times but it didnt help.
Also I tried using fake waiting loops to wait a bit to make sure everything is loaded but it also didnt help.
Also I tried calling OnCalculate several times but it didnt help. Also I tried using fake waiting loops to wait a bit to make sure everything is loaded but it also didnt help.
I highly doubt that OnCalculate is being called before OnInit has completed, but if it really is the case, then try using something like the following ...
bool g_bReady = false; int OnInit( void ) { g_bReady = false; // Not ready // ... do other tasks ... g_bReady = true; // Ready return INIT_SUCCEEDED; }; int OnCalculate( ... ) { if( !g_bReady ) return 0; // Not ready, so do nothing // ... do other tasks ... return rates_total; };
If it didn't help, then that shows that the OnCalculate is NOT being called before OnInit has completed. I did say that I doubted that it was the case.
Remember that when the market is closed, there are no ticks and OnCalculate is NOT called.
If it didn't help, then that shows that the OnCalculate is NOT being called before OnInit has completed. I did say that I doubted that it was the case.
Remember that when the market is closed, there are no ticks and OnCalculate is NOT called.
Agree. So we should look for another potential bug in code.
This indicator loads properly when applying the single time frame mode(use alternate resolution=false)
But when applying (use alternate resolution=true) it won't work in closed market. But works properly with strategy tester.
was not solved after all ?
weird , what does the sub-indicator when it's called for the first time ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This indicator loads properly when applying the single time frame mode(use alternate resolution=false)
But when applying (use alternate resolution=true) it won't work in closed market. But works properly with strategy tester.