[SOLVED] Indicators are not properly instantiated when called/created from an Indicator of different working time-frame. - page 4

 
nicholishen:

...

I want to especially thank you for all your help... if it weren't for your condescension I don't know where I would've found the motivation to strive on! /s

I have seen dozens of people like you here. They know all better than others, they don't listen, they put their own faults to other (an other user, a moderator, a broker, a platform, Metaquotes, the OS, or whatever...).

It seems you don't learn anything here. This is NOT a bug, it's how the developers conceived their platform. I understand why you say it's a bug, I discovered MT5 and how it works years ago. If you had this in mind and accept it, you will have see a lot sooner what was the problem : your approach and you understanding.

But not, still you are continuing to say it's a "bug" or a "major flaw", this is just ridiculous. MT5 architecture using asynchronous function behaviour is what make this platform a lot faster than MT4, of course it's not always easy to deal with it. The main Metaquotes fault here is incomplete, incomprehensible or lacking documentation.

When you don't understand something, you should listen other (Stanislav and me for example), and certainly not insulting people who are trying to help you.  

 
Alain Verleyen:

I have seen dozens of people like you here. They know all better than others, they don't listen, they put their own faults to other (an other user, a moderator, a broker, a platform, Metaquotes, the OS, or whatever...).

It seems you don't learn anything here. This is NOT a bug, it's how the developers conceived their platform. I understand why you say it's a bug, I discovered MT5 and how it works years ago. If you had this in mind and accept it, you will have see a lot sooner what was the problem : your approach and you understanding.

But not, still you are continuing to say it's a "bug" or a "major flaw", this is just ridiculous. MT5 architecture using asynchronous function behaviour is what make this platform a lot faster than MT4, of course it's not always easy to deal with it. The main Metaquotes fault here is incomplete, incomprehensible or lacking documentation.

When you don't understand something, you should listen other (Stanislav and me for example), and certainly not insulting people who are trying to help you.  

Running all indicators on a single thread without a method to recursively call the next iteration other than setting a timer is a flaw. You want to talk about speed? Instead of putting the processing back in queue I just spent an extra ms on a workaround. Probably not the end of the world, but still requires a workaround nonetheless. I'm much appreciative to those that helped me understand the workaround and why it was necessary given the constraint of the platform. I'm still trying to understand what you brought to the discussion other than condescension, however.
 
nicholishen:
Running all indicators on a single thread without a method to recursively call the next iteration other than setting a timer is a flaw. You want to talk about speed? Instead of putting the processing back in queue I just spent an extra ms on a workaround. Probably not the end of the world, but still requires a workaround nonetheless. I'm much appreciative to those that helped me understand the workaround and why it was necessary given the constraint of the platform. I'm still trying to understand what you brought to the discussion other than condescension, however.

I am finding you very agressive. From the start I was just trying to explain you what is happening, from my years of experience with MT5. I am not condescending, I am skilled and experimented, and I deserve respect (as every one). That's only from post #14 I see you want to have it working without a new tick, but on the same post I felt assaulted by your word "furiously", so I gave up. 

Anyway, the topic is closed, thanks for pushing me to learn something new

 

I was scratching my head for ages over this one.

For anyone else encountering this issue, there seems to be a simple work around.

Add a module level variable (RunOnce) to determine when we are running the OnCalculate for the first time. On that first run, return zero and set the variable true to prevent further interuptions.


bool RunOnce = false;

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
               
   if (rates_total == prev_calculated) return (rates_total);
   if (!RunOnce) {
      RunOnce = true;
      return (0);
   }
  
REST OF YOUR CODE HERE.


It's worked for me very nicely, I hope it helps you too.

[SOLVED]Indicators are not properly instantiated when called/created from an Indicator of different working time-frame.
[SOLVED]Indicators are not properly instantiated when called/created from an Indicator of different working time-frame.
  • 2017.01.30
  • www.mql5.com
UPDATE: See the workaround below CopyBuffer() throws an error of 4806 (Indicator data not accessible) when calling an indicator with a different Ti...
 
Tks for the solution
Reason: