Automatic validation fails when publishing new indicator to market place for MT5

 

Hello,


I was not able to pass "Automatic Validation" for my indicator when I try to publish it at market place for MT5.  The report is not very helpful in this case.

test on EURUSD,H1 (netting) test49323 (EURUSD,H1) OnInit return code is INIT_FAILED cannot initialize indicator disconnected I started to cut my code to find problem line in code.


I started to cut my code to find problem line in code.

And problem is at function 

ChartWindowFind

It always returns -1;


This code always fails with validation:

//+------------------------------------------------------------------+
//|                                                    Indicator.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 1
#property indicator_maximum 10
//--- input parameters
input int      Input1=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   const ENUM_PROGRAM_TYPE programType = (ENUM_PROGRAM_TYPE)::MQLInfoInteger(MQL_PROGRAM_TYPE);
   if (programType == PROGRAM_INDICATOR)
   {
      int _subwin = ChartWindowFind();
      if (_subwin < 0)
      {
         return INIT_FAILED;
      }
   }
   
   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[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


Can you help me to pass validation?

Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • www.mql5.com
Ask questions on technical analysis, discuss trading systems and improve your MQL5 programming skills to develop your own trading strategies. Communicate and share your experience with traders from anywhere in the world, answer questions and help beginners — MQL5.community is developing along with you. RSI on ARRAY Hello everyone, I am...
 
ALEKSANDR SHUKALOVICH:
 int _subwin = ChartWindowFind(); 
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
          General rules and best pratices of the Forum. - General - MQL5 programming forum
          Messages Editor
Reason: