iCustom function

 

Good afternoon colleagues, I have tried to use the iCustom function to read the V 75 Super indicator 1 indicator but I have not been able to get the values ​​I want, maybe I am entering the parameters wrong, but I have tried it in several ways and it always returns a value out of 10 when I print the read value. If anyone can help me I would appreciate it.

Buysignal = iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1,1,true,true,false,true, "Top KR","RED",1,0);

Print("SeñalBuy: ",Buysignal);

I have also tried it with fewer parameters and it does not give me results

Buysignal = iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1);

In the data windows are the values ​​Top KR and Bottom KR which are the values ​​I want to know



I stay tuned Thank you!
 
mddavid:

Good afternoon colleagues, I have tried to use the iCustom function to read the V 75 Super indicator 1 indicator but I have not been able to get the values ​​I want, maybe I am entering the parameters wrong, but I have tried it in several ways and it always returns a value out of 10 when I print the read value. If anyone can help me I would appreciate it.

I have also tried it with fewer parameters and it does not give me results

In the data windows are the values ​​Top KR and Bottom KR which are the values ​​I want to know



That’s because it returns a handle for using  the indicator not the value of the buffer
Use copybuffer to get the values


 
mddavid:

Good afternoon colleagues, I have tried to use the iCustom function to read the V 75 Super indicator 1 indicator but I have not been able to get the values ​​I want, maybe I am entering the parameters wrong, but I have tried it in several ways and it always returns a value out of 10 when I print the read value. If anyone can help me I would appreciate it.

I have also tried it with fewer parameters and it does not give me results

In the data windows are the values ​​Top KR and Bottom KR which are the values ​​I want to know



double buffer[];
int total = 10;
ArrayResize (buffer,total);
int Buysignal = iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1,1,true,true,false,true, "Top KR","RED",1,0);
if (Buysignal != INVALID_HANDLE){
for(int i=0; i<total; i++) {
CopyBuffer(Buysignal,0,0,1,buffer);
Print("SeñalBuy: ",buffer);
}
}

Not compiled, Not tested, just for example. You are trying to get values from a handle but you should expect values from buffer.

 
mddavid: it always returns a value out of 10

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

 
Pablo Anscombe #:
Eso es porque devuelve un identificador para usar el indicador, no el valor del búfer.
Use copybuffer para obtener los valores






Hello, I have tried to do it in the following way and it still does not give me results, could you tell me how to do it, I would appreciate it.

      double buffer[];
      int total = 10;
      ArrayResize (buffer,total);
      int Buysignal = iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1,1,true,true,false,true, "Top KR","RED",1,0);
      Print(Buysignal);
      if (Buysignal != INVALID_HANDLE){
      for(int i=0; i<total; i++) {
      CopyBuffer(Buysignal,0,0,1,buffer);

I'm new to this topic of buffers, I'm sorry, I really want to learn how to do it

I don't know if the parameters that I am entering in iCustom are the correct ones because I don't know the indicator

 
mddavid #: could you tell me how to do it,

What part of “You get that in OnInit” was unclear to you?

 
mddavid #:

Hello, I have tried to do it in the following way and it still does not give me results, could you tell me how to do it, I would appreciate it.

I'm new to this topic of buffers, I'm sorry, I really want to learn how to do it

don't use that code, it is not a good example.

look at the documentation where there is a working example

https://www.mql5.com/en/docs/indicators/icustom

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
iCustom - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
William Roeder #:

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)



Hello, good afternoon, I did what you are telling me, however I still do not get results, I did it for a moving average and it worked for me but with the indicator that I want to extract the information it does not let me, I share the code and a screenshot where I try to read in the current candlestick and I should get the value of Bottom KR of the indicator that is at that moment and it gives me a high value as shown in the expert section.

#property copyright "Copyright © 2023, Martin David"
#property version   "1.00"
//--- input parameters
//---
int    handle_iMA;                           // variable for storing the handle of the iMA indicator
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create handle of the indicator iMA
   handle_iMA=iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",0,1); 
//--- if the handle is not created
   if(handle_iMA==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code
      PrintFormat("Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early
      return(INIT_FAILED);
     }
//---
   return(INIT_SUCCEEDED);
  }
  //+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double array_ma[];
   ArraySetAsSeries(array_ma,true);
   int start_pos=0,count=20;
   
   int copy=CopyBuffer(handle_iMA,0,start_pos,count,array_ma);
   
   Print(copy);
   Print(array_ma[0]);
     

  }


I want to get the Top KR and Bottom KR values ​​of the indicator. I appreciate your collaboration.

I share the indicator so that you can help me please.

 
mddavid #:

Hello, good afternoon, I did what you are telling me, however I still do not get results, I did it for a moving average and it worked for me but with the indicator that I want to extract the information it does not let me, I share the code and a screenshot where I try to read in the current candlestick and I should get the value of Bottom KR of the indicator that is at that moment and it gives me a high value as shown in the expert section.


I want to get the Top KR and Bottom KR values ​​of the indicator. I appreciate your collaboration.

I share the indicator so that you can help me please.

Doing tests, it is reading the value but only from Top KR Blue when the arrow appears, I would only miss it when the red arrow appears Bottom KR


 
mddavid #: only from Top KR Blue when the arrow appears, I would only miss it when the red arrow appears Bottom KR
Your image shows there are two buffers. Read the other one.
 
William Roeder #:
Your image shows there are two buffers. Read the other one.
Of course, I made two buffers but I could not obtain the different values, for Top KR the red arrow works for me but for the Blue arrow it does not read values, they will not be the parameters that I enter in iCustom
If someone helps me, I appreciate it, I already have 50% thanks to you.
Reason: