Questions from a "dummy" - page 101

 
Desead:
Please advise how to get the bid and ask price for a currency pair that is not currently traded. In mt4 there was a marketinfo command, but in mt5 there is no such a command.

Helpful article - Migration from MQL4 to MQL5

Exactly to your question:

SymbolInfoDouble() and SYMBOL_BID/SYMBOL_ASK parameters

//Аналог маркетинфо
double  EurAsk = SymbolInfoDouble("EURUSD",SYMBOL_ASK);
double  EurBid = SymbolInfoDouble("EURUSD",SYMBOL_BID);

double  GbpAsk = SymbolInfoDouble("GBPUSD",SYMBOL_ASK);
double  GbpBid = SymbolInfoDouble("GBPUSD",SYMBOL_BID);
 
Can you tell me if mt5 has a news calendar in its tools, can the EA analyse them in any way? At least get the time of release and the currency the news will affect.
 
Lazarev:
Mfg, in mt5 there is a news calendar in the tools, can the EA analyse them in any way? At least get the release time and currency that will be influenced by the news.

If the news is marked on the chart (optionally controlled), then as I understand it, the EA can detect it. For the rest, we have to find a solution on our own.

For the second year I've been asking developers to implement news in MQL and provide an archive (and not per week as it is now).

 
Interesting:

If the news is marked on the chart (optionally controlled), then as I understand it, the EA can detect it. I have been asking the developers to link the news to MQL for two years now.

And for the second year I've been asking the developers to link the news to MQL and provide an archive (and not as now for a week).

If you have already mentioned in another thread that the news can be detected through graphical objects, could you tell me how? I want to write an EA that trades on the news, even if it is not optimized in the tester, I may correct it myself somehow on a demo account
 
Lazarev:
I would like to develop an Expert Advisor that trades on the news, even if it is not optimized in the Strategy Tester, I may have to fine-tune it myself on a demo account

The news displayed on the chart are graph objects of type OBJ_EVENT, you can get information on this type, but it is very poor, you can only get the news name and time of release, neither significance nor other information from the calendar table will get.

Here's a script that adds vertical lines to news events, I think as a starting point for your theme will do.

Files:
 
I can't figure out what is drawing in the indicator. I.e. which function is giving the order to draw. Can someone give me an example of OnCalculate function body which draws a straight line with value 17.
Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Основы языка / Функции / Функции обработки событий - Документация по MQL5
 
Desead:
I cannot understand what exactly is drawn in the indicator . I.e. which function orders drawing. Can someone give me an example of the OnCalculate function body that draws a straight line with the value 17.

Indicator buffers or graph objects?

HH the indicator buffers are drawn in the indicator, the arrays are not declared as such, the drawing styles are defined in preprocessor properties #property indicator_...

That is, everything in the indicator buffers will be automatically drawn.

Files:
Test.mq5  3 kb
 
Urain:

Indicator buffers or graph objects?

HH the indicator buffers are drawn in the indicator, those arrays are not declared as such, the drawing styles are set in the preprocessor properties #property indicator_...

That is all that is in indicator buffers will be automatically drawn.

Thank you, I will take a look at it now.

The problem is very simple, to plot in a separate window the price difference between eurusd and gbpusd. I have got the prices of current quotes. The difference, respectively, also. It means, for every tick I have some value, according to which, I need to draw a point that will form a line or draw a line at these coordinates.

I figured out that I should use buffers and arrays with differently directed indication, I can't really understand what for, bearing in mind I don't need smoothing by period. I will look for information about drawing by graphic objects, may be there is something I need.

 
Desead:

Thank you, I will take a look at it now.

In general the task is very simple, to plot in a separate window the price difference between eurusd and gbpusd. I have got the prices of the current quotes. The difference, respectively, also. It means, for every tick I have some value, according to which, I need to draw a point that will form a line or draw a line at these coordinates.

I figured out that I should use buffers and arrays with differently directed indication, I can't really understand what for, bearing in mind I don't need smoothing by period. I will look for drawing by graphical objects, may be there is something I need.

Pay attention, there will be problems with synchronization. First you need to create a synchronized database and then do subtractions.

string Symbolbuf[6]={"EURUSD","GBPUSD","AUDUSD","USDJPY","USDCHF","USDCAD"};
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
datetime fmin(datetime value1,datetime value2)
  {
   return(value1<value2?value1:value2);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
datetime fmax(datetime value1,datetime value2)
  {
   return(value1>value2?value1:value2);
  }  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   datetime timestart;
   timestart=(datetime)SeriesInfoInteger(Symbolbuf[0],PERIOD_M1,SERIES_FIRSTDATE);
   for(int i=1;i<6;i++)
     {
      timestart=fmax(timestart,(datetime)SeriesInfoInteger(Symbolbuf[i],PERIOD_M1,SERIES_FIRSTDATE));
      Print(Symbolbuf[i]," = ",(datetime)SeriesInfoInteger(Symbolbuf[i],PERIOD_M1,SERIES_FIRSTDATE));      
     }
   Print("-----------------   ",timestart);  
   for(int i=0;i<6;i++)
     {
      Print(Symbolbuf[i]," = ",Bars(Symbolbuf[i],PERIOD_M1,timestart,TimeCurrent()));
     }
  }
 

Hello. I want to run my Expert Advisor on AUD/USD. How do I do that, I only have it working on euro/dollar. I have changed the pair in the Service/Settings/Debug menu. But I got the message"The selected symbol was not found".

Thank you.

Документация по MQL5: Получение рыночной информации / SymbolSelect
Документация по MQL5: Получение рыночной информации / SymbolSelect
  • www.mql5.com
Получение рыночной информации / SymbolSelect - Документация по MQL5
Reason: