How to get values from Custom Indicator

 
Hey guys, I'm trying to create an expert advisor based on an indicator. I've created it using iCustom but I have no idea how to get values from it. Can you guys help me?
 
  1. iCustom) return a handle (an int). You get that in OnInit. In OnTick (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.03.08
              How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
              How to call indicators in MQL5 - MQL5 Articles 12 March 2010

  2. Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. We don't know what indicator you mean or what specific version — always post the indicator or a link.
         How To Ask Questions The Smart Way. 2004
              Be precise and informative about your problem

  3. Figure out what buffer(s) indexes you want and read them.
              Detailed explanation of iCustom - MQL4 programming forum
 

DOWNLOAD AROON INDICATOR https://www.mql5.com/en/code/388

BLENND, I HOPE INFORMATION WITHIN CODE BELOW ANSWER YOUR QUESTIONS


//+------------------------------------------------------------------+
//|                                               AroonIndicator.mq5 |
//|                                Copyright 2021, DAAL TECHNOLOGIES |
//|                                             https://www.mql5.com |
//|                                            Author :Adedapo Alabi |
//|                                            dapsonrock@yahoo.com  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, DAAL TECHNOLOGIES"
#property link      "https://www.mql5.com"
#property version   "1.00"


input ENUM_TIMEFRAMES AroonTimeFrame = PERIOD_CURRENT;

//+++Two Indicator input paratemeres I wish to contol from my Expert Adviser code+++//
input int AroonPeriod= 9; // period of the indicator 
input int AroonShift = 0; // horizontal shift of the indicator in bars



int Aroon_handle;

//Create an array for price data


double AroonBull[]; //Buffer for storing Aroon Bull confirmation
double AroonBear[]; //Buffer for storing Aroon Bear confirmation
   
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  
   //--- create handle of the indicator iCustom   DOWNLOAD AROON CODE https://www.mql5.com/en/code/388
      Aroon_handle=iCustom(_Symbol,AroonTimeFrame,"aroon",AroonPeriod,AroonShift);
   //--- if the handle is not created
      if(Aroon_handle==INVALID_HANDLE)
        {
         //--- tell about the failure and output the error code
         PrintFormat("Failed to create handle of the iCustom 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 deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   AroonIndicatorProcessor();

   
  }
//+------------------------------------------------------------------+



   
   
void AroonIndicatorProcessor()
   {
      ArraySetAsSeries(AroonBull,true);
      ArraySetAsSeries(AroonBear,true);

      //https://www.mql5.com/en/docs/series/copybuffer
      // Aroon_handle represent information captured from Icustom 
      // 0 represent first, 1 represent second buffer as it is arranged in your indicator code section >>>As for my indicator there are only two outputs as there are only 2 buffers
      // 0 represent start position 
      // 3 represent buffer 0, 1 & 2 copy 
      // AroonBull reprenet declared array created to indicator output values
      CopyBuffer(Aroon_handle,0,0,3,AroonBull);
      CopyBuffer(Aroon_handle,1,0,3,AroonBear);
      
      Comment( "Bulls is ", AroonBull[0],       //FOR TEST PURPOSE TO CONFIRM IF VALUE IS THE SAME AS VALUE ON GRAPH
               "\n", "Bears is ", AroonBear[0]  //FOR TEST PURPOSE TO CONFIRM IF VALUE IS THE SAME AS VALUE ON GRAPH
               
             );
      
   }
   
   
   
   
Aroon
Aroon
  • www.mql5.com
Aroon indicator created by Tushar Chande indicates if a long-term trend is going to an end or just pausing a little before a new movement.
Reason: