Questions from a "dummy" - page 122

 

Please tell me why a simple script like this doesn't work:

#include <Indicators\Indicators.mqh>

void OnStart()

{

CiOpen m_open;

bool z=m_open.Create(Symbol(),Period());

Print(m_open.GetData(1));

}

 
IlshatG:

Please tell me why a simple script like this doesn't work:

#include <Indicators\Indicators.mqh>

void OnStart()

{

CiOpen m_open;

bool z=m_open.Create(Symbol(),Period());

Print(m_open.GetData(1));

}

Need it like this:

#include <Indicators\Indicators.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   CiOpen m_open;        
//---
   bool z=m_open.Create(Symbol(),Period());
   m_open.Refresh();
   Print(m_open.GetData(1)); 
  }
 
uncleVic:

I need it like this:

Thank you. So you should always use refresh before accessing the data?

What should I do in case of Expert Advisors? If I create a new class of trading signals and set variable m_used_series=USE_SERIES_OPEN+USE_SERIES_CLOSE;

Can I directly access prices Open(Ind) and Close(Ind) in class methods?

Документация по MQL5: Основы языка / Типы данных / Структуры и классы
Документация по MQL5: Основы языка / Типы данных / Структуры и классы
  • www.mql5.com
Основы языка / Типы данных / Структуры и классы - Документация по MQL5
 
IlshatG:

Thank you. So you should always use refresh before accessing the data?

What should I do in case of Expert Advisors? If I create a new class of trading signals and set variable m_used_series=USE_SERIES_OPEN+USE_SERIES_CLOSE;

Can I directly access prices Open(Ind) and Close(Ind) in class methods?

Yes.

All indicators and timeseries used in an Expert Advisor created on the basis of the Standard Library are automatically added to the collection of indicators of the Expert Advisor (and therefore, they are automatically kept in a "fresh" state).

 
uncleVic:

Yes.

All indicators and timeseries used in the Expert Advisor, created on the basis of the Standard Library, are automatically added to the collection of indicators of the Expert Advisor (and, as a consequence, are automatically kept "fresh").

Thank you. Now I understand how it works.
 
IlshatG:
Please, advise how to connect MQL cloud network for calculations? I am testing an Expert Advisor. But the cloud agents are inactive and are not highlighted. I have checkedUse->MQL5 Cloud Network. I have 2 dollars of bonus funds in my account. Maybe I should tick some more options or put more money in my account?

Have you specified your correct MQL5 login and password in the terminal settings in "Tools - Settings - MQL5.community"?

This should result in showing the available balance in the agents window:


 
Renat:

Have you specified your correct MQL5 login and password in the terminal settings in "Tools - Settings - MQL5.community"?

As a result, the available balance should appear in the agents window:


Yes, I specified correct login and the balance was shown in the window. I have the platform installed, which I downloaded from the broker's website. Build 574 dated January 12. I have now tried installing the latest version platform fromhttps://www.metatrader5.com/, and I can see the available agents in it. It seems that the issue is that the metatrader from the broker is not the latest version and does not update automatically? Is it possible to update the terminal to the current version manually?
MetaTrader 5 Trading Platform for Forex Trading
  • www.metatrader5.com
The MetaTrader 5 Trading Platform is designed to provide brokerage services to traders in Forex, CFD, Futures, as well as stock markets. Become a broker and start rendering services to traders on the financial markets.
 
IlshatG:
Yes, I entered the correct login and the balance is displayed in the window. I have the platform installed, which I downloaded from the broker's website. Build 574 dated January 12. I have now tried installing the latest version platform fromhttps://www.metatrader5.com/, and I can see the available agents in it. It seems that the issue is that the metatrader from the broker is not the latest version and is not automatically updated? Is it possible to update the terminal to the current version manually?

Yes, you had a very old version of the terminal.

To upgrade to the latest version, just type "MetaQuotes" in the server selection window, wait for new servers and highlight the demo account on the MetaQuotes-Demo server:

On our server there are always new versions of programs. Once connected, an upgrade is sure to happen.

 
Renat:

Yes, you had a very old version of the terminal.

To upgrade to the latest version, just type "MetaQuotes" in the server selection window, wait for new servers and allocate a demo account on the MetaQuotes-Demo server:

There are always new versions of programs on our server. Once connected, an upgrade will surely happen.

It's working. Thank you!
 
papaklass:

What's the catch? What don't I understand?

So there are no compilation errors. But like this:

It gives out an error

1.

MqlRates mrate[];
mrate[] = {0};

Error - initialization is possible only when declaring:MqlRates mrate[] = {4};

2. ArraySetAsSeries() is applicable only to dynamic arrays. An array that was initialized becomes static. An example of a dynamic array:MqlRates mrate[];

Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5