Please help with error codes as it worked one minute and the next I get error code

 

Hi Everyone. 

Im trying to create an expert adviser that works on RSI.

Basically once the RSI(14) gets to 90 the expert should open a sell order. I would like for it to open a new sell order every 6 candles. I want to use it for crash500. The I got it to open one sell order but not sure how do make it to open more orders every 6 candles for a total of 3 orders. I would also like to know how I can add a trailing stop to these orders so that once in profit it should stay open for about 3 candles then close the orders. Does anyone please have some advise as I am new to coding

#include <Trade\Trade.mqh>



CTrade trade;



void OnTick()

  {

// create an empty String

   string enrty ="";



// Get the Ask price

   double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);



// Get the Bid price

   double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);



// create an Array for several prices

   double myMovingAverageArray17[],myMovingAverageArray80[];



//define the properties of the Moving Average

   int movingAverageDefinition1 = iMA (_Symbol,_Period,17,0,MODE_EMA,PRICE_CLOSE);



// define the properties of the Moving Average2

   int movingAverageDefinition2 = iMA (_Symbol,_Period,80,0,MODE_EMA,PRICE_CLOSE);



// sort the price array1 from current candle downwards

   ArraySetAsSeries(myMovingAverageArray17,true);



// sort the price array2 from the currant candle downwards

   ArraySetAsSeries(myMovingAverageArray80,true);



// Define MA1, one line, current candle,3 candles, store results

   CopyBuffer(movingAverageDefinition1,0,0,3,myMovingAverageArray17);



// Define MA2, one line, current candle,3 candles, store results

   CopyBuffer(movingAverageDefinition2,0,0,3,myMovingAverageArray80);



   if (  // Check if the 17 candle EA is above the 80 candle EA

      (myMovingAverageArray17[0]>myMovingAverageArray80[0])

      && (myMovingAverageArray17[1]<myMovingAverageArray80[1])

   )

   {

      entry="buy";

     }



   if (  // Check if the 80 candle EA is above the 20 candle EA

      (myMovingAverageArray17[0]<myMovingAverageArray80[0])

      && (myMovingAverageArray17[1]>myMovingAverageArray80[1])

      )

      {

      entry=="sell";

     }



// sell 20 Mikrolot

   if (entry =="sell" && PositionsTotal()<1)

      trade.Sell(0.20,NULL,Bid,0,(Bid-150 * _Point),NULL);



   if (entry =="buy" && PositionsTotal()<1)

      // buy 20 Microlot

      trade.Buy(0.20,NULL,Ask,0, (Ask+150 * _Point),NULL);

  }

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




 

What if you use code that works instead of trying every beginner mistake: https://www.mql5.com/en/search#!keyword=RSI%20EA&module=mql5_module_articles.

Bear in mind there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready even for you.

 
Thanks. Will have a look