I have a basic coding error for MT4 EA

 

Hello, please see the two errors attached. I will paste the code below, I would greatly appreciate if you could tell me what to put exactly where. Thanks in advance 


#property version   "1.00"



#property strict







input double Lots=0.01;



input double TrailingStopStart=100;



input double TrailingStopStep=10;



input double TrailingStopEnd=200;



input int TradeDays=127;



input int StartHour=0;



input int StartMinute=0;



input int EndHour=23;



input int EndMinute=59;







string ChartName = "Chart Smart Trading";



color ChartNameColor=clrRed;







int ticket;



int orderType;



double stopLoss;



double takeProfit;







int OnInit()



{



   ObjectCreate(0, ChartName, OBJ_LABEL, 0, 0, 0);



   ObjectSetText(ChartName, ChartName, 12, "Arial", ChartNameColor);



   return(INIT_SUCCEEDED);



}







void OnTick()



{



   int day = DayOfWeek();



   if (TradeDays & (1 << day))



   {



      int time = TimeCurrent();



      int currHour = TimeHour(time);



      int currMinute = TimeMinute(time);







      if (currHour >= StartHour && currHour <= EndHour && currMinute >= StartMinute && currMinute <= EndMinute)



      {



         double ema21 = iMA(NULL, 0, 21, 0, MODE_EMA, PRICE_CLOSE, 0);



         double vwap = iCustom(NULL, 0, "vwap", 0, 0);



         double rsi = iRSI(NULL, 0, 14, PRICE_CLOSE, 0);



         double k, d;



         Stochastic(NULL, 0, 14, 5, 3, 3, MODE_SMA, MODE_SMA, k, d);







         if (Close[0] < ema21 && Close[0] > vwap && rsi < 20 && CrossOver(k, d))



         {



            orderType = OP_BUY;



            stopLoss = Low[1] - 100 * Point;



            takeProfit = High[1];



            ticket = OrderSend(NULL, orderType, Lots, Ask, 3, stopLoss, takeProfit, NULL, 0, 0, Green);







            if (ticket < 0)



            {



               Print("Error opening order: ", GetLastError());



            }



            else



            {



               if (TrailingStopStart > 0)



               {



                  OrderModify(ticket, Bid, Ask, NormalizeDouble(Bid - TrailingStopStart * Point, Digits), NormalizeDouble(Ask + TrailingStopEnd * Point, Digits), 0, Green);



               }



            }



         }



         else if (Close[0] > ema21 && Close[0] < vwap && rsi > 80 && CrossUnder(k, d))



         {



            orderType = OP_SELL;



            stopLoss = High[1] + 100 * Point;



            takeProfit = Low[1];



            ticket = OrderSend(NULL
 

Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.

 
Fernando Carreiro #:

Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.

I believe I have reposted correctly? 
 
  1. 4411042 #: I believe I have reposted correctly? 

    Do you really have that blank space in your actual code file? I doubt it. I think you copy and pasted what you originally posted, not what is in your code file.

               takeProfit = Low[1];
                                                                   
                                                                    
                                                                    
                ticket = OrderSend(NULL                             

    You definitely did not post all the code.

  2.          double ema21 = iMA(NULL, 0, 21, 0, MODE_EMA, PRICE_CLOSE, 0);

    Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  3. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

 
4411042:

Hello, please see the two errors attached. I will paste the code below, I would greatly appreciate if you could tell me what to put exactly where. Thanks in advance 


I can't be bothered to read your code due to the number of blank lines.

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 
I have deleted your duplicated topic.