Sunday, April 23, 2023

 

Step to step writing notes to learning MT5 EA programming.



Step 1- Its basic 20 lines given by MQL5 New EA templates, So just keep the below 20 lines and Delete balance unwanted lines to keep simple.


#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit(){
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason){
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick(){
  }
//+------------------------------------------------------------------+

 now fresh writing starting for our TimeTrader. in here program concepts is Opening order in Particular time and Closing order in Particular time. Example open order in 10 O clock and Close it in 3 hours later 13 O'clock. In here order open time and closing time is our input decision. So first we take it in code.

Step 2 : add the belw five lines in previous code as Line as 4,5,6,7,8. Now confirm total lines 25.


//+------------------------------------------------------------------+
//| Variables                                 |
//+------------------------------------------------------------------+
input int OpenHour;
input int CloseHour;



Step 3- We need predefined trading functions for Easy programming, So add the include function call. New lines added in 4,5,6 and 7. 7th line only actual program line and balance 3 lines are comments for easy reading.  now total lines 29. 






Step 4- Now additional variable added in below 12th line for trade call, check in image and add that 13th line program, now total 30 lines. 




Step 5- Now added time hour converstion and trade condition call lines in above image.  new 10 lines added below 28th line.  firs to line for fixing time and next if loop for matching the input hour and is there order running or not. is it no order and time is match then new order will open, thats same is match the close hour and its any running order, then it will get close if second loop matched.

its very simple 40 line program. but actually only very simple and two condtion only need to learn, thats fixing the time hour and trade orders status. .. its working fine in MT5 demo account.  
Only for education purpose. 



MT5 EA programming learning from zero

  • Uploaded by: Forex Trading Site
  • Views:
  • Category:
  • Share

    0 comments:

    Post a Comment

     

    Our Team Members

    Copyright © Forex Trading Tutorial | Designed by Templateism.com | padugai.com
    Introducer of

    FxPro

    WARNING: .

    Legal: FxPro Financial Services Ltd is authorised and regulated by the CySEC (licence no. 078/07)

    Risk Warning: CFDs, which are leveraged products, incur a high level of risk and can result in the loss of all your invested capital. Therefore, CFDs may not be suitable for all investors. You should not risk more than you are prepared to lose. Before deciding to trade, please ensure you understand the risks involved and take into account your level of experience. Seek independent advice if necessary.
    IMPORTANT NOTE: this site belongs to an FxPro affiliate and not to FxPro. Therefore, the content of the site including but not limited to material, information, opinion(s), advertisement(s), suggestion(s) and product(s) on offer is not endorsed by FxPro. Consequently, FxPro does not assume any liability for any representation made through this site and is not responsible for any loss incurred as a result of such representation.