Indicators cannot work together

 

Hi everybody and a good day. I coded 6 indicators that trace automatic channels on different timeframes, they work flawlessly alone but they stop working when applied together to the chart.

Every indicator use a handle to get the timeframe IMA data and I declared them in OnInit as you said.

First indicator handle:

void OnInit()
  {
  handleM1=iMA(NULL,PERIOD_M1,1,0,MODE_SMA,PRICE_MEDIAN);
  }

second indicator handle:

void OnInit()
  {

  handleM5=iMA(NULL,PERIOD_M5,1,0,MODE_SMA,PRICE_MEDIAN);

  }

Third indicator handle:

void OnInit()
  {

  handleM15=iMA(NULL,PERIOD_M15,1,0,MODE_SMA,PRICE_MEDIAN);

  }

Fourth indicator handle:

void OnInit()
  {

  handleH1=iMA(NULL,PERIOD_M1,60,0,MODE_SMA,PRICE_MEDIAN);

  }

Fifth indicator handle:

void OnInit()
  {

  handleH4=iMA(NULL,PERIOD_M1,240,0,MODE_SMA,PRICE_MEDIAN);

  }

Sixth indicator handle:

void OnInit()
  {

  handleD1=iMA(NULL,PERIOD_M1,1440,0,MODE_SMA,PRICE_MEDIAN);

  }


Also, every indicator use different variable names for the icons, the lines and internal calculations.

During debug I noticed the indicators stop calculate the iMAs when working together. What could it be the problem?

 
danerstizz:

Hi everybody and a good day. I coded 6 indicators that trace automatic channels on different timeframes, they work flawlessly alone but they stop working when applied together to the chart.

Every indicator use a handle to get the timeframe IMA data and I declared them in OnInit as you said.

First indicator handle:

second indicator handle:

Third indicator handle:

Fourth indicator handle:

Fifth indicator handle:

Sixth indicator handle:


Also, every indicator use different variable names for the icons, the lines and internal calculations.

During debug I noticed the indicators stop calculate the iMAs when working together. What could it be the problem?

Are you using objects on chart? Sometimes object names interfere with each other.

 

Yes, there are many objects, buy I accurately named them differently. But even if the object name interfered with each other I cannot explain why the iMA calculations stop.

Is there some kind of buffer or other internal metatrader function that get overwhelmed?

 
danerstizz #:

Yes, there are many objects, buy I accurately named them differently. But even if the object name interfered with each other I cannot explain why the iMA calculations stop.

Is there some kind of buffer or other internal metatrader function that get overwhelmed?

Difficult to say without source file.
 

I don't think the code would clarify anything, there are only internal calculations and it would lead out of topic.

I'm only wondering if in the metatrader there is some kind of buffer or other internal function that get overwhelmed by using too much the iMA function or other function. Thanks

 
danerstizz:

During debug I noticed the indicators stop calculate the iMAs when working together. What could it be the problem?

What does this "stop calculate" mean?

 
danerstizz:

Also, every indicator use different variable names for the icons, the lines and internal calculations.

During debug I noticed the indicators stop calculate the iMAs when working together. What could it be the problem?

  1. Variable names are irrelevant. Only Global Variables of the Terminal and object names can be seen outside a program.

  2. How To Ask Questions The Smart Way. (2004)
              Don't rush to claim that you have found a bug.
    Questions Not To Ask
              My program doesn't work. I think system facility X is broken.

    It is almost always your code.

  3. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

    On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
              Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
              Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
              Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
              Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
              SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)

 
danerstizz:

Hi everybody and a good day. I coded 6 indicators that trace automatic channels on different timeframes, they work flawlessly alone but they stop working when applied together to the chart.

Every indicator use a handle to get the timeframe IMA data and I declared them in OnInit as you said.

First indicator handle:

second indicator handle:

Third indicator handle:

Fourth indicator handle:

Fifth indicator handle:

Sixth indicator handle:


Also, every indicator use different variable names for the icons, the lines and internal calculations.

During debug I noticed the indicators stop calculate the iMAs when working together. What could it be the problem?

Wait, do you call them together or do you create the OnInit function for each one?


void OnInit()
  {
  handleM1=iMA(NULL,PERIOD_M1,1,0,MODE_SMA,PRICE_MEDIAN);

  handleM5=iMA(NULL,PERIOD_M5,1,0,MODE_SMA,PRICE_MEDIAN);

  handleM15=iMA(NULL,PERIOD_M15,1,0,MODE_SMA,PRICE_MEDIAN);

  handleH1=iMA(NULL,PERIOD_M1,60,0,MODE_SMA,PRICE_MEDIAN);

  handleH4=iMA(NULL,PERIOD_M1,240,0,MODE_SMA,PRICE_MEDIAN);

  handleD1=iMA(NULL,PERIOD_M1,1440,0,MODE_SMA,PRICE_MEDIAN);
  }
 
danerstizz #:

I don't think the code would clarify anything, there are only internal calculations and it would lead out of topic.

I'm only wondering if in the metatrader there is some kind of buffer or other internal function that get overwhelmed by using too much the iMA function or other function. Thanks

No. The issue comes from your code.

 
Carl Schreiber #:

What does this "stop calculate" mean?

Hi, Carl. It means the lines on the screen stop moving because the iMA is not calculated anymore inside the code. I'm sure of that because I used  a Print line to watch the iMA progress.
 
Manuel Arturo Gonzales Espinosa #:

Wait, do you call them together or do you create the OnInit function for each one?


Hi Manuel. Every indicator has its own OnInit handles call as I explained above.
Reason: