Unable to call marketinfo on mql5

 

Please am new to mql5

I want to run a simple mql5 program that will return the bid or ask price once OnTick() is called, but am getting compilation error once i compile my program

Errors such as 'MarketInfo' - undeclared identifier    Test.mq5    34    27

',' - unexpected token    Test.mq5    34    46
'EURUSD' - some operator expected    Test.mq5    34    38
'MODE_BID' - semicolon expected    Test.mq5    34    47
'MODE_BID' - undeclared identifier    Test.mq5    34    47
'MODE_BID' - semicolon expected    Test.mq5    34    47
'MODE_BID' - undeclared identifier    Test.mq5    34    47
')' - unexpected token    Test.mq5    34    55
6 errors, 0 warnings        7    1


My code


//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                                  Copyright 2022, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#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()
  {
//---

   double newcurrencyBid= MarketInfo("EURUSD",MODE_BID);
   Print("Converter value is", newcurrencyBid);
   
  }
//+------------------------------------------------------------------+
 
5000543585:

Please am new to mql5

I want to run a simple mql5 program that will return the bid or ask price once OnTick() is called, but am getting compilation error once i compile my program

Errors such as 'MarketInfo' - undeclared identifier    Test.mq5    34    27

',' - unexpected token    Test.mq5    34    46
'EURUSD' - some operator expected    Test.mq5    34    38
'MODE_BID' - semicolon expected    Test.mq5    34    47
'MODE_BID' - undeclared identifier    Test.mq5    34    47
'MODE_BID' - semicolon expected    Test.mq5    34    47
'MODE_BID' - undeclared identifier    Test.mq5    34    47
')' - unexpected token    Test.mq5    34    55
6 errors, 0 warnings        7    1


My code


MarketInfo is something you have made up and not a function which is why you are getting errors

Use the correct function https://www.mql5.com/en/docs/marketinformation

try looking at SymbolInfoTick

 
Paul Anscombe #:

MarketInfo is something you have made up and not a function which is why you are getting errors

Use the correct function https://www.mql5.com/en/docs/marketinformation

try looking at SymbolInfoTick

Thanks alot it work with your answer

I copied that code online

 
5000543585 #:

Thanks alot it work with your answer

I copied that code online

You’re welcome 
 
5000543585 #:

Thanks alot it work with your answer

I copied that code online

MarketInfo() is a MQL4 function and does not exist in MQL5.