Indicator doesn't work properly in EA.

 

Hello.

I have coded a multi currency ea for mt5
and when i try to test it the indicator lod but it doesn't appear in the tester chart and don't show data.

and when trying on single currency it didn't work either.

here's the code any help?
the used indicators are attached 

//+------------------------------------------------------------------+
//|                                                      testttt.mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include<Trade\Trade.mqh>
CTrade trade;
input int ATR_period=14;
//+------------------------------------------------------------------+
double atr[];
string symbols[
3];
double mains[];
double atrpanel[
3];
int main_value[
3];
input ENUM_TIMEFRAMES time_frame=PERIOD_H4;//time frame you should define one.
int id_number=1001;
input int ma_period=20;
input double divisor=2;
input double atr_tp_multiplier=1;
input double atr_sl_multiplier=2;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ArraySetAsSeries(atr,true);
   ArraySetAsSeries(mains,true);
//ArraySetAsSeries(symbols,true);
   symbols[0]="AUDUSD";
   symbols[1]="AUDCAD";
   symbols[2]="AUDCHF";
//---

   for(int i=0; i<3; i++)
     {
      iCustom(symbols[i],time_frame,"Agent",ChartID(),id_number+i);
      main_value[i]=iCustom(symbols[i],time_frame,"Hull average 2",ma_period,divisor,0);
      atrpanel[i]=iATR(symbols[i],time_frame,14);
     }
////////////////////////////////////////////

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
/*void OnTick()
  {
//---

  }
  */
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
//**loop start**\\
   static int symbol_num=0;
   for(int i=0; i<3; i++)
     {
      if(StringFind(symbols[i],sparam,0)!=-1)
        {
         symbol_num=i;

        }
     }
//**loop end**\\
//**code here start**\\
   double vsd=CopyBuffer(main_value[symbol_num],0,0,20,mains);
   double spoint=SymbolInfoDouble(sparam,SYMBOL_POINT);
   int digits=SymbolInfoInteger(sparam,SYMBOL_DIGITS);
   double ask=SymbolInfoDouble(sparam,SYMBOL_ASK);
   double bid=SymbolInfoDouble(sparam,SYMBOL_BID);
   double sl=500*spoint;
   double tp=500*spoint;
/////////////////////
   double atrbuf=CopyBuffer(atrpanel[symbol_num],0,0,3,atr);
   double atr_points=atr[1];



/////////////////////////////////////////////
   double t=(atr_points*atr_tp_multiplier);
   double s=(atr_points*atr_sl_multiplier);
////
//+------------------------------------------------------------------+
/////

   double Close1=iClose(sparam,time_frame,1);
   double Close2=iClose(sparam,time_frame,2);
   int positions=0;//PositionsTotal();
   static double up_count=0;
   static double dn_count=0;
   if(mains[1]>mains[2])
     {
      up_count++;
      dn_count=0;
     }
   if(mains[1]<mains[2])
     {
      up_count=0;
      dn_count++;
     }
// Print(big_ma[1]);
   if(up_count==1)
     {
      trade.Buy(0.1,sparam,ask,ask-s,ask+t,NULL);
     }



/////////////////////////////
   if(dn_count==1)
     {
      trade.Sell(0.1,sparam,bid,bid+s,bid-t,NULL);
     }


//+------------------------------------------------------------------+



  }

//+------------------------------------------------------------------+
//**code here end**\\
Files:
Agent.mq5  3 kb
 

In the indicator, trading functions DO NOT WORK. Remove from the CTrade indicator.

The indicator calculates in OnCalculate. Add OnCalculate to your indicator.

 
It's Expert Advisor not Indicator!
 
Any help?
 

SOLVED!

The indicator i call has price enumeration in it's settings
i've chosen the price method with numbers 0 as example refers to PRICE_Close
but it's wrong i should type the right price enumeration.