Apply custom indicator handle in other custom indicator handle

 
//+------------------------------------------------------------------+
//|                                                 Donchian-RSI.mq5 |
//|                                  Copyright 2021, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"

//+------------------------------------------------------------------+
//| EA includes                                                      |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
CTrade         m_trade;                // trading object

#include <Trade\SymbolInfo.mqh>
CSymbolInfo    m_symbol;               // symbol info object

//+------------------------------------------------------------------+
//| EA input parameters                                              |
//+------------------------------------------------------------------+
  input double   Lots     =0.1;        // Lots

//+------------------------------------------------------------------+
//| Variables for storing the EA data                                |
//+------------------------------------------------------------------+
  int handle_Donchian;                 // variable for storing the handle of the Donchian indicator 
  int handle_RSI;                      // variable for storing the handle of the RSI indicator 

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   //*  Calling Donchian_Bands indicator   *
      handle_Donchian = ChartIndicatorGet(0,0,"Donchian_Bands(25)");
      if(handle_Donchian==INVALID_HANDLE)
        {
         //---tell about the failure and output the error code 
          PrintFormat("handle_TMA: Failed to create handle of the Donchian indicator for the symbol %s/%s, error code %d",
                     Symbol(),
                     EnumToString(Period()),
                     GetLastError());
         //---the indicator is stopped early 
          return(INIT_FAILED);
         }
   //*    Calling Parabilic RSI indicator   *
//---Create handle of the indicator Parabolic Sar
     handle_RSI = ChartIndicatorGet(0,1,"RSI-SAR");
     if(handle_RSI==INVALID_HANDLE)
       {
        //--- tell about the failure and output the error code 
         PrintFormat("handle_RSI: Failed to create handle of the RSI indicator for the symbol %s/%s, error code %d",
                     Symbol(),
                     EnumToString(Period()),
                     GetLastError());
        //--- the indicator is stopped early 
         return(INIT_FAILED);
        }
   ChartIndicatorAdd(0,1,handle_Donchian);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+

I'm facing a problem! I can get the Handles of two custom indicators using ChartIndicatorGet (Donchian [Main chart Window] and RSI[Separate window]). How can I apply the RSI handle to the Donchian handle and add the resulting handle to the separate window.

 
Check out the help: 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
 
Vladimir Karputov #:
Check out the help: iCustom

Thank you very much! Many people here on the forum say that icustom has problems, but with great calm and dedication I managed to use it without any problems. An important function, practical and very simple to use. Once again, Thanks!