MQL5 CopyBuffer and iCustom CPU usage

 

Hi, in mql5 i have some part of my EA code (i will put only some parts) i have 10 icustom and 7 timeframe usage. i use onTick because i need to follow the conditions returned by these indicators within 7 timeframe on every tick. however when i set my robot only in 4 symbol because of copybuffer cpu goes 100 percent, in mql4 using icustom does not affect such cpu usage. is there any fix or wrong usage of icustom and copybuffer?:

int OnInit()

  {

   for(int i = 0; i < 7; i++) {

      handlearray[0][i] = iCustom(symbolName,periodLarge[i],"\Indicators\Examples\a1number2");

      handlearray[1][i] = iCustom(symbolName,periodLarge[i],"\Indicators\Examples\a2numara2");

   }


}

void OnTick()

  {

//---

//+------------------------------------------------------------------+


   CopyBuffer(handlearray[0][1], 1, 0, 1, sonuc);

   indicatorCalculationResult[0][1] = sonuc[0];


   CopyBuffer(handlearray[0][1], 2, 0, 1, sonuc1);

   indicatorCalculationResult[1][0] = sonuc1[0];

}
 
aenes22346:

Hi, in mql5 i have some part of my EA code (i will put only some parts) i have 10 icustom and 7 timeframe usage. i use onTick because i need to follow the conditions returned by these indicators within 7 timeframe on every tick. however when i set my robot only in 4 symbol because of copybuffer cpu goes 100 percent, in mql4 using icustom does not affect such cpu usage. is there any fix or wrong usage of icustom and copybuffer?:

int OnInit()

  {

   for(int i = 0; i < 7; i++) {

      handlearray[0][i] = iCustom(symbolName,periodLarge[i],"\Indicators\Examples\a1number2");

      handlearray[1][i] = iCustom(symbolName,periodLarge[i],"\Indicators\Examples\a2numara2");

   }


}

void OnTick()

  {

//---

//+------------------------------------------------------------------+


   CopyBuffer(handlearray[0][1], 1, 0, 1, sonuc);

   indicatorCalculationResult[0][1] = sonuc[0];


   CopyBuffer(handlearray[0][1], 2, 0, 1, sonuc1);

   indicatorCalculationResult[1][0] = sonuc1[0];

}
First of all: Post your code as "code" please...

Then, it might be an issue with the custom indicators.
 
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
          General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
              Messages Editor
          Forum rules and recommendations - General - MQL5 programming forum (2023)

  2.  handlearray[0][i] = iCustom(symbolName,periodLarge[i],"\Indicators\Examples\a1number2");
    A backslash is a quote character. If you want one, you must double it.
              Character Constants - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5