Cześć, chciałbym przerobić wskaźnik który był tutaj wrzucony kilka stron temu. Programista ze mnie żaden jednak w szkole coś tam miałem z programowania więc nie wydaje mi się to problemem. Chodzi mi dokładniej o funkcję iCustom, umiem ją napisać jednak nie wiem w którym miejscu w kodzie mam ją napisać. Dodatkowo jak to wygląda w sytuacji kiedy muszę pobrać buffor z 2 różnych wskaźników nie załączonych w mt4? Kod tego wskaźnika co był tutaj wrzucany wygląda tak:
Kod: Zaznacz cały
 //+------------------------------------------------------------------+
//|                                                      CCI_RSI.mq4 |
//|                        Copyright 2019, Dariusz Surdel aka. Dadas |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Gehtsoft USA LLC"
#property link      "http://fxcodebase.com"
#property version   "1.0"
#property strict
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 clrRed
input int Period1 = 14; // CCI Period
input int Period2 = 14; // RSI Period
input bool WPR    = false; // CCI -> WPR
input int Period3 = 14; // WPR Period
input bool Reverse = false; // Reverse
string IndicatorName;
string IndicatorObjPrefix;
string GenerateIndicatorName(const string target)
{
   string name = target;
   int try = 2;
   while (WindowFind(name) != -1)
   {
      name = target + " #" + IntegerToString(try++);
   }
   return name;
}
double Oscillator[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   if(!WPR)
   IndicatorName = GenerateIndicatorName("RSI CCI Ratio");
   if(WPR)
   IndicatorName = GenerateIndicatorName("RSI WPR Ratio");
   
   IndicatorObjPrefix = "__" + IndicatorName + "__";
   IndicatorShortName(IndicatorName);
   IndicatorBuffers(1);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, Oscillator);
   SetIndexLabel(0, "Oscillator");
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int counted_bars = IndicatorCounted();
   int minBars = 1;
   int limit = MathMin(Bars - 1 - minBars, Bars - counted_bars - 1);
   for (int i = limit; i >= 0; i--)
   {
      double cciValue = iCCI(_Symbol, _Period, Period1, PRICE_CLOSE, i);
      double rsiValue = iRSI(_Symbol, _Period, Period2, PRICE_CLOSE, i);
      double wprValue = iWPR(_Symbol, _Period, Period3, i);
      if(!WPR)
       {
      if (Reverse)
      {
         if (rsiValue != 0)
         {
            Oscillator[i] = cciValue / rsiValue;
         }
      }
      else
      {
         if (cciValue != 0)
         {
            Oscillator[i] = rsiValue / cciValue;
         }
      }
      }
      if(WPR)
       {
      if (Reverse)
      {
         if (rsiValue != 0)
         {
            Oscillator[i] = wprValue / rsiValue;
         }
      }
      else
      {
         if (wprValue != 0)
         {
            Oscillator[i] = rsiValue / wprValue;
         }
      }
      }
      
   }
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
// More information about this indicator can be found at:
//http://fxcodebase.com/code/viewtopic.php?f=38&t=69516
//+------------------------------------------------------------------+
//|                               Copyright © 2020, Gehtsoft USA LLC | 
//|                                            http://fxcodebase.com |
//+------------------------------------------------------------------+
//|                                      Developed by : Mario Jemic  |
//|                                           mario.jemic@gmail.com  |
//|                          https://AppliedMachineLearning.systems  |
//+------------------------------------------------------------------+
//|                                 Support our efforts by donating  |
//|                                  Paypal : https://goo.gl/9Rj74e  |
//|                                 Patreon : https://goo.gl/GdXWeN  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   ObjectsDeleteAll(ChartID(), IndicatorObjPrefix);
}
//+------------------------------------------------------------------+