Am I wrong or is it the new mql5 build 1915? - page 4

 
Anthony Garot:

I have heard about using OnTimer() to get multi-currency indicators working on the weekend, but after trying it myself, I figured it was some sort of mythical beast, like a unicorn or liopleurodon.

Well, I wiped out all my historical data, started MT5, and loaded your code on USDCAD,D1.

It spun and spun and spun without stopping . . . .

I'll be honest, though—I didn't really look at your code yet. I'm pretty exhausted after a long run this morning and too much coffee thereafter.

I'll look through the code this week and test it next weekend.

Thank you for the snippet. I am sure there is a kernel of truth in it that I can use.

Oh, and it appears I forgot an 'n' on your name when I renamed your file (unintentional), and I misstated the mythical nature of liopleurodons (intentional).

Hmm... that appears like you were not connected to the broker server. Did you perhaps disconnect your network connection to test no-ticks?


Anyway... I never really spent much time with this, but after more testing just now it looks like what's actually happening is that whenever an indicator is created from oninit, the oncalculate handler is actually called twice (without the need for ontimer). So the stages would be as such:

  1. OnInit - "other" indicator(s) created
  2. OnCalulate called 1st time. Use CopyBuffer (or CIndicator wrappers) to "Refresh" the "other" indicator on this first pass.
  3. "other" indicators are scheduled to run on the same thread. 
  4. "other" indicators finish running on thread.
  5. OnCalcate handle invoked by system one more time.
  6. At this point indicators should be up provided no missing history. 

 
nicholi shen:

Hmm... that appears like you were not connected to the broker server. Did you perhaps disconnect your network connection to test no-ticks?

Looks like I never responded to this.

I was indeed connected to the broker server.

It appeared to "not work" when all data was missing. If I ran it when some data was in the cache, it worked. Of course, I only played with it for a bit before the market opened. I'll play with this more this weekend.

 
nicholi shen:
  1. OnInit - "other" indicator(s) created
  2. OnCalulate called 1st time. Use CopyBuffer (or CIndicator wrappers) to "Refresh" the "other" indicator on this first pass.
  3. "other" indicators are scheduled to run on the same thread. 
  4. "other" indicators finish running on thread.
  5. OnCalcate handle invoked by system one more time.
  6. At this point indicators should be up provided no missing history. 

I got a chance to run through your code when the market closed.

It still didn't work on D1 time frame. I didn't chase this down entirely because I found that it worked fine under H1. I suspect it was the min number of bars that was the culprit.

Anyway, the code example did work on H1, and exactly as you enumerated above.

I played around with it a bit, which means that I added a bunch of PrintFormat() statements. Print() all the things!

It seems that I can replace the millisecond timer with a standard 1 second timer. Under both, the time to download the data was 17 seconds. The benefit of using a 1s timer is that the log doesn't fill up as fast with debugging messages (that I added for my understanding and edification).

I traced the CIndicators, CIndicator, CIndicatorBuffer wrapper around Refresh. Sure enough, this was just a wrapper around CopyBuffer() as you said. I did find interesting the 1024 DEFAULT_BUFFER_SIZE.

Anyway, thank you  @nicholi shen for the example. I now see that multi-currency data can be pulled reasonably well on a weekend.

 
Anthony Garot:

I got a chance to run through your code when the market closed.

It still didn't work on D1 time frame. I didn't chase this down entirely because I found that it worked fine under H1. I suspect it was the min number of bars that was the culprit.

Anyway, the code example did work on H1, and exactly as you enumerated above.

I played around with it a bit, which means that I added a bunch of PrintFormat() statements. Print() all the things!

It seems that I can replace the millisecond timer with a standard 1 second timer. Under both, the time to download the data was 17 seconds. The benefit of using a 1s timer is that the log doesn't fill up as fast with debugging messages (that I added for my understanding and edification).

I traced the CIndicators, CIndicator, CIndicatorBuffer wrapper around Refresh. Sure enough, this was just a wrapper around CopyBuffer() as you said. I did find interesting the 1024 DEFAULT_BUFFER_SIZE.

Anyway, thank you  @nicholi shen for the example. I now see that multi-currency data can be pulled reasonably well on a weekend.

Awesome! Thanks for the feedback. 

Reason: