My EA will simply not execute any orders

 

Hello, hope everyone is well. 


I am new to mql5 and for some reason when i go to test my EA it doesn't execute any buy or sell positions.  There are no syntax errors

Here is my code. Thank you in advance for your help :) 


vo
   
  }




 

Mistake number 1: The worst and worst mistake:

  //we calculate a EMA for All 5 
   double MyMovingAverageYellow = iMA ( _Symbol , _Period , 5 , 0 , MODE_EMA , PRICE_CLOSE , 0 );
   double MyMovingAverageRed = iMA ( _Symbol , _Period , 13 , 0 , MODE_EMA , PRICE_CLOSE , 0 );
   double MyMovingAverageAqua = iMA ( _Symbol ,   _Period , 50 , 0 , MODE_EMA , PRICE_CLOSE , 0 );
   double MyMovingAverageGrey = iMA ( _Symbol ,   _Period , 200 , 0 , MODE_EMA , PRICE_CLOSE , 0 );
   double MyMovingAverageBlue = iMA ( _Symbol ,   _Period , 800 , 0 , MODE_EMA , PRICE_CLOSE , 0 );
   //Identifiys pip difference
 

Remember - in MQL5 the indicator handle is created once (in OnInit ()). Then they get the data using CopyBuffer (in OnInit ()).

Read the help: the indicator handle has the 'int' type.


Error 2:

OrderSend


Error 3:

Close[0] >= Open[0] &&  Close[1] < Open[1];
 
Vladimir Karputov:

Mistake number 1: The worst and worst mistake:

Remember - in MQL5 the indicator handle is created once (in OnInit ()). Then they get the data using CopyBuffer (in OnInit ()).

Read the help: the indicator handle has the 'int' type.


Error 2:


Error 3:

Thank you for your response what is wrong with the orderSend?
 
Anna U :
Thank you for your response what is wrong with the orderSend?

Read the help:

OrderSend

The OrderSend() function is used for executing trade operations by sending requests to a trade server.

bool  OrderSend(
   MqlTradeRequest&  request,      // query structure
   MqlTradeResult&   result        // structure of the answer
   );


But first, fix the main mistake - the indicator handle should be created only once (in OnInit ()).

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trading is done by sending orders to open positions using the OrderSend() function, as well as to place, modify or delete pending orders. Each trade order refers to the type of the requested operation. Trading operations are described in the ENUM_TRADE_REQUEST_ACTIONS enumeration...