Does any one know why my code willl only execute one of this signals listed instead of all?

 

Hi developers, I have a bit of trouble here. I'm able to make the standard moving average signal execute trades but the harmonic signal only shows the harmonic intergration charts but does not execute in favor of my harmonic indicator. Could I be missing something?


int OnInit(void)
  {
#include  "Includ/o_init.mqh"  

//--- Initializing expert
   if(!ExtExpert.Init(Symbol(),Period(),Expert_EveryTick,Expert_MagicNumber))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing expert");
      ExtExpert.Deinit();
      return(-1);
     }
     

double ask = SymbolInfoDouble(NULL,SYMBOL_ASK) ;
double bid = SymbolInfoDouble(NULL,SYMBOL_BID) ;
double buyStopLoss = ask- stopLossPips*_Point ;  
double sellStopLoss = bid + stopLossPips*_Point ;
double buyTakeProfit = bid +
TakeProfitPips*_Point ;
double sellTakeProfit = ask - TakeProfitPips*_Point ;

   if (lastTrough<lastPeak){ 
   if (totalPositions==0)
  trade.Buy(lotValue,NULL,ask,buyStopLoss,buyTakeProfit,NULL) ;
  }

   else if (lastTrough>lastPeak){
   if (totalPositions<=0)
  trade.Sell(lotValue,NULL,bid,sellStopLoss,sellTakeProfit,NULL) ;
    }

CopyBuffer(harmonicHandle,0,0,5,Peaks);
CopyBuffer(harmonicHandle,1,0,5,Troughs);

//-------
//--- Creation of signal object
   CSignalMA *signal=new CSignalMA;
   if(signal==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating signal");
      ExtExpert.Deinit();
      return(-2);
     }
//--- Add signal to expert (will be deleted automatically))
   if(!ExtExpert.InitSignal(signal))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing signal");
      ExtExpert.Deinit();
      return(-3);
     }
//--- Set signal parameters
   signal.PeriodMA(Inp_Signal_MA_Period);
   signal.Shift(Inp_Signal_MA_Shift);
   signal.Method(Inp_Signal_MA_Method);
   signal.Applied(Inp_Signal_MA_Applied);
   
//--- Check signal parameters
   if(!signal.ValidationSettings())
     {
      //--- failed
      printf(__FUNCTION__+": error signal parameters");
      ExtExpert.Deinit();
      return(-4);
     }
//--- Creation of trailing object
   CTrailingFixedPips *trailing=new CTrailingFixedPips;
   if(trailing==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Add trailing to expert (will be deleted automatically))
   if(!ExtExpert.InitTrailing(trailing))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Set trailing parameters

//--- Creation of money object
   CMoneyFixedRisk *money=new CMoneyFixedRisk;
   if(money==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating money");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
      if (useTraiulingStop==true){
 
 double trailingStop = trailingStopPips*_Point ;
  
 
   if (PositionsTotal()>0){
       PositionSelect(Symbol()) ;
         ulong ticket = PositionGetTicket(0) ;
          double openPrice = PositionGetDouble(POSITION_PRICE_OPEN) ;
           double positionProfit = PositionGetDouble(POSITION_PROFIT) ;
           double positionTakeProfit = PositionGetDouble(POSITION_TP) ;
          if (PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY){
             if (ask-openPrice>2*trailingStop)
             trade.PositionModify(ticket,bid-trailingStop,buyTakeProfit) ;
          
          }
      
           else 
           if (openPrice-ask >trailingStop)
             trade.PositionModify(ticket,bid+trailingStop,sellTakeProfit) ;
           
     }
   
   
   }
 
//--- Add money to expert (will be deleted automatically))
   if(!ExtExpert.InitMoney(money))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing money");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
     
//--- Set money parameters
   money.Percent(Money_FixRisk_Percent);
//--- Check all trading objects parameters
   if(!ExtExpert.ValidationSettings())
     {
      //--- failed
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Tuning of all necessary indicators
   if(!ExtExpert.InitIndicators())
     {
      //--- failed
      printf(__FUNCTION__+": error initializing indicators");
      ExtExpert.Deinit();
      return(-11);
     }
//--- succeed
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Deinitialization function of the expert                          |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ExtExpert.Deinit();
  }
//+------------------------------------------------------------------+
//| Function-event handler "tick"                                    |
//+------------------------------------------------------------------+
void OnTick(void)
  {
   if (work)  ExtExpert.OnTick();
  }
//+------------------------------------------------------------------+
//| Function-event handler "trade"                                   |
//+------------------------------------------------------------------+
void OnTrade(void)
  {
   ExtExpert.OnTrade();
  }
//+------------------------------------------------------------------+
//| Function-event handler "timer"                                   |
//+------------------------------------------------------------------+
void OnTimer(void)
  {
#include "Includ/o_timer.mqh"  
  if (work) ExtExpert.OnTimer();
  }
//+------------------------------------------------------------------+

The indicator is in the folder