iCustom function - page 2

 
mddavid # Of course, I made two buffers but I could not obtain the different values

 int copy=CopyBuffer(handle_iMA,0,start_pos,count,array_ma

You only have one CopyBuffer reading one indicator buffer.  Why does not “obtaining the different values” surprise you? What part of “read the other one” was unclear to you?

 

Perhaps I did not make myself understand well, I made another buffer for the other variable but I still do not know the value when the blue arrow appears and that the indicator has the data in the Bottom KR variable, I am sharing the code so that you please correct me some mistake.

I don't know how to get the two values ​​of Top KR and Bottom KR from the indicator

#property copyright "Copyright © 2023, Martin David"
#property version   "1.00"
//--- input parameters
//---
int    handle_iMA;                           // variable for storing the handle of the iMA indicator
int    handle_iMA_2;

//+------------------------------------------------------------------+
//| 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); 
   handle_iMA_2=iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1); 
   Comment("signal 1:",handle_iMA, "\nsignal 2:",handle_iMA_2);
  
   
//--- if the handle is not created
   if(handle_iMA_2==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);
     }
     
   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[];
   double array_ma_2[];
   ArraySetAsSeries(array_ma,true);
   ArraySetAsSeries(array_ma_2,true);
   int start_pos=0,count=20;
   
   int Sellsignal=CopyBuffer(handle_iMA,0,start_pos,count,array_ma);
   int Buysignal=CopyBuffer(handle_iMA_2,0,start_pos,count,array_ma_2);
   

   Print("Señal sell : ",array_ma[4]);
   Print("Señal buy : ",array_ma_2[1]);
     

  }

For this code I try to read candle 4 and candle 1 but I only get the value of candle 4



 
mddavid #:

Perhaps I did not make myself understand well, I made another buffer for the other variable but I still do not know the value when the blue arrow appears and that the indicator has the data in the Bottom KR variable, I am sharing the code so that you please correct me some mistake.

I don't know how to get the two values ​​of Top KR and Bottom KR from the indicator

For this code I try to read candle 4 and candle 1 but I only get the value of candle 4



You only need one icustom statement.  
You need two copybuffer statements one for each buffer which you specify in the copybuffer statement 
See the manual 
https://www.mql5.com/en/docs/series/copybuffer
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
  • www.mql5.com
CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
  1.    handle_iMA=iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",0); 
       handle_iMA_2=iCustom (Symbol() , PERIOD_CURRENT,"V 75  Super Indicator 1",1); 

    Why are you running the indicator twice with different parameters?

  2.    int Sellsignal=CopyBuffer(handle_iMA,0,start_pos,count,array_ma);
       int Buysignal=CopyBuffer(handle_iMA_2,0,start_pos,count,array_ma_2);
    

    Why are you reading the same buffer, when you want to read both buffers?

  3. mddavid #: I don't know how to get the two values ​​of Top KR and Bottom KR from the indicator

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

 
Guillermo Roeder # :
  1. ¿Por qué está cancelado el indicador dos veces con diferentes parámetros?

  2. ¿Por qué está leyendo el mismo búfer, cuando quiere leer ambos búferes?

  3. Quizás deberías leer el manual. Cómo hacer preguntas de forma inteligente . (20 04 ) Cómo interpretar las respuestas . RTFM y STFW: Cómo saber que la cagaste seriamente .
       
          
             

I already got the desired results, thank you very much for your help. I am very grateful. Blessings.

 
Paul Anscombe #:
You only need one icustom statement.  
You need two copybuffer statements one for each buffer which you specify in the copybuffer statement 
See the manual 
https://www.mql5.com/en/docs/series/copybuffer

I already got the desired results, thank you very much for your help. I am very grateful. Blessings.

Reason: