Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1878

 
x572intraday #:

Can you give me an example (or at least a key line), because I can't think of anything? Is it also going to be a huge list of values with sifting through the left-hand values, or is there only a useful one? At the moment I don't think there's anything to sift from, there are no left-handed ones in the list... but I can't get hold of the idea.

To avoid going through all possible enum values (because it's really long) the following preparations should be made(something like caching). Then with the help of this function you can easily translate string/rows to enum knowing ranges of all needed enums. Or one can search for enum in a comparatively small range.

template<typename T>
bool StringToEnum(const string i_str, T &o_val, int i_min_enum, int i_max_enum)
{
   for(int i = i_min_enum; i <= i_max_enum && !IsStopped(); i++) {
     o_val = (T)i;
     if(i_str == EnumToString(o_val))
       return(true);
   }
   o_val = WRONG_VALUE;
   return(false);
}


template<typename T>
bool StringToEnum(const string i_str, T &o_val) { return StringToEnum(i_str, o_val, INT_MIN, INT_MAX); } // медленный вариант
 
Vitaly Muzichenko #:

How did you determine that it wasn't starting, how can you tell?

P.S.

Try it like this

The second expert in OnInit section makes conclusions in log and there are no log messages. The log does not even contain a message from the terminal about the start of the Expert Advisor. And the name of the Expert Advisor does not appear on the chart in the upper right corner.

 
12345678902003 #:
And what function is used for this purpose? MqlRates? And if I use ObjectGet, I should specify the object property there; if I take OBJPROP_PRICE, how should I make it fetch the price to the current bar.

Get is Get. And there is a function to get price or time on a bar from an object by name or by type of object and name get a certain property of the object. Not the bar number but the offset from zero is used.

 
Valeriy Yastremskiy #:

Get is Get. And there is a function to get price or time on a bar from an object by name or by type of object and name get a certain property of the object. Not the bar number, but the offset from zero is used.

This can be done using the ObjectGetValueByTime() function.

Example

double p = ObjectGetValueByTime( 0,"имя объекта...",Time[0]);
 
I have the following problem - the Terminal\MQL4\Indicators folder has indicators in its indicator list, but the terminal MQL4 itself does not have these indicators in its list from which these indicators are dragged onto the chart. How to make these indicators appear in the terminal list, so that they can be used in the chart of the MQL4 terminal ? In the screenshot on the right side are those indicators that are available in the MQL4 terminaland on the left side are indicators of the same terminal in theMQL4 4\Indicators folder (as an example)
Files:
 
Halina Okopna-Pecuch #:
I have the following problem - the list of indicators in the folder Terminal\MQL4\Indicators contains indicators, but in the terminal MQL4 in its list from which these indicators are dragged on the chart, they are not. How to make these indicators appear in the terminal list, so that they can be used in the chart of the MQL4 terminal ? In the screenshot on the right side are those indicators that are available in the MQL4 terminaland on the left side are indicators of the same terminal in theMQL4 4\Indicators folder (as an example )

These are probably not indicators.

 
Halina Okopna-Pecuch #:
The problem is as follows - the Terminal\MQL4\Indicators folder has indicators in the indicators list, but the terminal MQL4 itself does not have these indicators in its list from which these indicators are dragged onto a chart. How to make these indicators appear in the terminal list, so that they can be used in the chart of the MQL4 terminal ? In the screenshot on the right side are those indicators that are available in the MQL4 terminaland on the left side are indicators of the same terminal in theMQL4 4\Indicators folder (as an example )

Try dropping these files into the Experts and Scripts folders and see what appears in their respective folders in the terminal.

 
Andrey Sokolov #:

They are probably not indicators

They are indicators because they are displayed on other terminals and not on this one in particular, although they are in fact there

 
Mihail Matkovskij #:

Try dropping these files into the Experts and Scripts folders and see what appears in their respective folders in the terminal.

Everything is unchanged. No indicators on the terminal

 
Halina Okopna-Pecuch #:

Everything is unchanged. No indicators on the terminal

This folder (data directory), of this terminal?

Try restarting the terminal

or right click, navigator tab -- indicators , ---- refresh.

Reason: