Mastering MQL5: Getting Started with MQL5 - Day 1

Familiarize with the MetaEditor IDE and create a simple script to display "Hello, World!" in the Experts tab of MT5.

Mastering MQL5: Getting Started with MQL5 - Day 1
avatar
Stormie
2 min read·
--
Comments
No comment yet!

Let's start our journey!


Download and Install MT5


Step 1: Go to MT5 Official Website and install the application

Nothing special, you just download and install it with default setting.

https://www.metatrader5.com/en


Step 2: Create your MT5 account

Step 3: Wait for the Application install done and login to it

  • Click to 1 as in the Image below, and now you can start trading with the demo account you create at step 2. We will NOT arm to make money yet, so be patient.
  • To show the Chart of currency pair that you want to flow, "Right click on the pair" > "Chart window"
  • To change the Timeframe, "Right click on chart" > "Timeframes" > "5M"


Step 4: Place your first position

  • "On the Chart" > "Press F9"
  • Just try to Buy or Sell as you wish, I will Buy here.
  • Now let place a Close deal by click on the Chart at your target price and place an "Take Profit" order.


Start coding


Step 1: open the MetaEditor IDE

  • in your MT5, just hit the keyboard "F4", it will open new window call "MetaEditor"


Step 2: Create new script

  • clicking "File" > "New" > "Script" in the MetaEditor menu
  • Change your Script file name in the first input by adding the name after "Script\"
  • Create > You will get something like this.


Step 3: Replace all code by the code below

// Expert Advisor entry function
void OnTick()
{
  // Display "Hello, World!" in the Experts tab of MT5
  Print("Hello, World!");
}


Step 4: Run your first "Hello, World!"

  • Hit keyboard "F5" mean run debugging on real time data
  • the window will get back to your MT5, just accept any pop up (we did not use any real money yet, so relax)
  • click to "Experts" tab and check the "Hello, World!" print out every tick


That is it for today. Thank for reading and hope you enjoy.