Hello PLEASE i need help with adding SL,TP,TRAILING STOP and MOVING AVERAGE FILTER TO THIS EA I CODED

 
      
   #include<Trade\Trade.mqh>
    
    // create an instance of CTrade
    CTrade trade;
    
input int SmallMovingAverage=10;
input int BigMovingAverage=25;

void OnTick()
  {
    // we calculate the ask price
    double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
    
    // we calculate the BID price
    double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
    
         // create a string for the signal
         string signal="";
         
         // create array for several prices
         double SmallMovingAverageArray[],BigMovingAverageArray[];
         
         //define the properties of the Small Moving Average
         int SmallMovingAverageDefinition = iMA(_Symbol,_Period,SmallMovingAverage,0,MODE_SMA,PRICE_CLOSE);
         
         //define the properties of the big Moving Average
         int BigMovingAverageDefinition = iMA(_Symbol,_Period,BigMovingAverage,0,MODE_SMA,PRICE_CLOSE);
         
         // Defined EA, one line,current candle,3 candles, store result
         CopyBuffer(SmallMovingAverageDefinition,0,0,3,SmallMovingAverageArray);
         
         // Defined EA, one line,current candle,3 candles, store result
         CopyBuffer(BigMovingAverageDefinition,0,0,3,BigMovingAverageArray);
         
         // if BigMovingAverage > SmallMovingAverage
         if (BigMovingAverageArray[1] > SmallMovingAverageArray[1])
         
         // if BigMovingAverage < SmallMovingAverage
         if (BigMovingAverageArray[2] < SmallMovingAverageArray[2])
         {
           signal="buy";
         }
       
              
         // Buy 5 lot
         if (signal=="buy" && PositionsTotal()<1)
         trade.Buy(3.00,NULL,Ask,0,(Ask+3000* _Point),NULL);
         
         // chart output
         Comment("The signal is now: ",signal);
       

 }

 
Please edit your post and

use the code button (Alt+S) when pasting code

Do not double post!

I have deleted your duplicated post.


 
Keith Watford:
Please edit your post and

use the code button (Alt+S) when pasting code

Do not double post!

I have deleted your duplicated post.


I DID
 
  1. Do not SHOUT at us, that is RUDE. Fix your post and your title.
  2. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum 2018.05.12

Reason: