System not working !!!! help

 

Hi, I have created this simple system witch has the task of buying when the moving avegrae on dayli chart is above the price bid and the adx is below 30 while it has to sell when the moving average is above the bid price and the ADX is above 70; 

But I don't understand why it doesn't work , among other things the period of the moving average should be 100, but when in the platform I check the input data the period of the moving average is 12 ; 

Can you tell me where I went wrong ?
Thanks in advance !

//+------------------------------------------------------------------+
//|                                               Experttutorial.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Trade\Trade.mqh>
CTrade trade ;          // Moving Average(12,0,...) Period of averaging
input int                Signal_MA_Shift      =0;           // Moving Average(12,0,...) Time shift
input ENUM_MA_METHOD     Signal_MA_Method     =MODE_SMA;    // Moving Average(12,0,...) Method of averaging
input ENUM_APPLIED_PRICE Signal_MA_Applied    =PRICE_CLOSE; // Moving Average(12,0,...) Prices series
input double             Signal_MA_Weight     =1.0;         // Moving Average(12,0,...) Weight [0...1.0]
input int                Signal_ADX_Period    = 14;
//cretae an instance of CTrade called trade
double MA [];
int MA_handle;
double ADX [];
int ADX_handle ; 


int OnInit()
  {
//--- create rsi 
ADX_handle =  iADX ( _Symbol , PERIOD_M30 , Signal_ADX_Period  );
//create MA
MA_handle = iMA (_Symbol, PERIOD_D1, 100 , Signal_MA_Shift , Signal_MA_Method , Signal_MA_Applied);
if (ADX_handle<0 && MA_handle < 0 )
{
Print ( "La creazione di irsi e fallita " , INVALID_HANDLE );
Print ( "Errore di runtime " , GetLastError()) ; 
return (-1) ;
}
return ( 0 ) ;
}

void OnTick()
  {

//---we calculate the ask price 
double Ask = NormalizeDouble ( SymbolInfoDouble ( _Symbol, SYMBOL_ASK ), _Digits );
double Bid = NormalizeDouble (SymbolInfoDouble ( _Symbol, SYMBOL_BID ) , _Digits );

ArraySetAsSeries (MA, true);
ArraySetAsSeries (ADX , true); 
ArraySetAsSeries( MA,true);
CopyBuffer ( MA_handle , 0, 0, 3, MA );
CopyBuffer (ADX_handle, 0, 0, 3 , ADX ) ;
double ADXValue = NormalizeDouble ( ADX [0] , 2 ); 
double MAValue = NormalizeDouble ( MA [0], 2 );
// we open test sell position 10 Microlot if RSI<70 
if (PositionsTotal() == 0)
if (ADXValue > 70 && MAValue  > Bid ) 
  { 
   trade.Sell (0.10 , NULL, Bid , (Bid +50 * _Point ), 50 , NULL );  
  }
  
 if (PositionsTotal () == 0)
 if  (ADXValue < 30 && MAValue < Bid )
 {
 trade.Buy (0.10, NULL, Bid, (Bid + 50 * _Point ), 50 , NULL);
 }
  
// we create a chart output
Comment (  
          "RSI Value : ", ADXValue 
          );
          } //Ende fuctuion 
         
void CheckTrailingStop ( double Ask ) 
{
double SL = NormalizeDouble (Ask -150* _Point , _Digits );
for (int i=PositionsTotal ()-1 ; i>=0 ; i--)
{string symbol = PositionGetSymbol (i);

if (_Symbol == symbol )
{
ulong PositionTicket = PositionGetInteger (POSITION_TICKET ) ;
double CurrentStopLoss = PositionGetDouble (POSITION_SL) ;
if (CurrentStopLoss < SL)
{
  trade.PositionModify ( PositionTicket, ( CurrentStopLoss + 10* _Point ), 0);
} 
}
}
}