Learning to Code MQL5 for beginners

 

Hello everyone,

I am just starting out learning how to code EA's in MT4 using the MQL5 language and have been working my way through the reference guide to learn the basics to begin with.

Does anyone have any advice on how best to learn how to code? It all appears to be in computer programming language which I am unfamiliar with.....

What is the best place to start?

Thank you

 

There are different way to start learn MQL5. 

you can go  How to Start with Metatrader 5

My recommend::

Search for "MQL5 Programming Basics" ,there are about 4-5 articles ( string, array, Clist class, File, and much more.) Checking yourself if you understand most of them, if not, you need C++ Primer book like I do. Then start learning more on OOP design, UML diagram, bitwise operation, hexadecimal, ASCII, Unicode,(trust me it will help you so much later on ).  Go back and forward until you get what they said in the articles. Most articles are translated from Russian and most of the authors are expert. You need to keep up with the masters... 

And there are more search like "MQL5 Cookbook" series, "MQL5 Wizard" Series

Check \Include\ folder  which you can learn how to use all the classes that come with MT5 

Learn to use Doxygen to  help you visualize how those project relate to each other.

Have fun..


How to start with MQL5
How to start with MQL5
  • 2018.12.24
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 

RSI CODE with PositionsTotal()<1) is blocking to take trade on other currency pairs


Hi Team,


I am new to trading, but i have managed to write a code for RSI, when I select PositionsTotal()<1)  its blocking  all other currency pairs to open a trade when RSI meet as per the code, but I am loosing an opportunity to take a trade on other currency pair, when  there is one active trade.


I want to open one trade per currency pair and need multiple positions should be open in different currency pairs when RSI met the requirement..

what additional code I need to include to achieve this..kindly suggest me.. Thank you..

3

      // Sell 10 Microlot

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

  trade.Sell(0.02,NULL,Bid,(Bid+5000 * _Point),(Bid-337 * _Point),NULL);

  

  // Buy 10 Microlot

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

  trade.Buy(0.02,NULL,Ask,(Ask-5000 * _Point),(Ask+337 * _Point),NULL);

  

  // screen output 

   Comment ("myRSIValue: ",myRSIValue,"\n","Signal: ",signal);

  

  // create a chart output

  Comment ("The current signal is ",signal);

  

  }

 

Forum on trading, automated trading systems and testing trading strategies


When you post code please use the CODE button (Alt-S)!

Use the CODE button

 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".