Skip to content
MQL5 Programming Getting Started Guide

MQL5 Programming Getting Started Guide

2024-06-15

Introduction

MQL5 is the programming language for the MetaTrader 5 platform, used for developing automated trading strategies, custom indicators, and scripts.

Environment Setup

  1. Install MetaTrader 5 terminal
  2. Open MetaEditor (press F4)
  3. Create a new Expert Advisor

Your First EA

//+------------------------------------------------------------------+
//|                                                  MyFirstEA.mq5   |
//+------------------------------------------------------------------+
int OnInit()
  {
   Print("EA initialized");
   return(INIT_SUCCEEDED);
  }

void OnTick()
  {
   double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   Print("Current ASK price: ", ask);
  }
Last updated on