Questions from Beginners MQL5 MT5 MetaTrader 5 - page 758
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Getting errors - what's wrong? In MQL4 it works...
Have you seen theiMA help?
Step one: declare a variable in the "header" to store iMA indicator handle:
Step two: create indicator handle in OnInit().
And the result (crosshair on the screenshot is set at bar #1):
If I try to use double MA[1] in loop, should I use double MA[1]; or it's better to request/receive the bigger array size? I just don't understand why all these complications are needed - what's the advantage as compared to MQL4.
My example with the iMAGet functionis an example designed for receiving one value at a time from an indicator. If you want to get more values from the indicator, you should useCopyBuffer with parameters "from" and "to" and saving the result in an array.
Added: there will be an example later ...
Promised example.
Input parameters:
Working with the array and the Moving Avegarege indicator in the Expert Advisor:
Please pay attention to array arr_ma and values of elements with index #0 and with index #8.
ds
My example with the iMAGet functionis an example designed for receiving one value at a time from the indicator. If you want to get several values from the indicator, you should useCopyBuffer with parameters "from" and "to" and saving the result in an array.
Added: there will be an example later ...
Promised example.
Input parameters:
Working with the array and the Moving Avegarege indicator in the Expert Advisor:
Please pay attention to array arr_ma and values of elements with index #0 and with index #8.
ds
Thanks for the example!
It's very important for me to understand if there is any advantage in requesting a single indicator value and copying a dozen of indicator values - maybe there was some research on that?
The fact that the time series is reversed - it's not good - I'm used to the standard numbering of bars 0123, but here I get 1230 in reverse order.
If I don't know how many bars I need during the search (for example, when we are searching for the MA and bar crossing point), then I should request the maximal possible number? Does it affect the performance in any way?
Thanks for the example!
It is very important for me to understand if there is an advantage in requesting a single indicator value and copying a dozen indicator values - maybe there has been some research on this?
...
Who's stopping us from doing the research ourselves :) ?
The fact that the time series is reversed - it's not good - I'm used to the standard numbering of bars 0123, and here we have 1230 in reverse order.
...
If I don't know what number of bars I will need in the search (for example, when searching for a MA and bar crossing point), should I request the maximum possible number? Does it affect the performance in any way?
In such cases, it's better to make several queries. For example, first query - 50 elements, if necessary - second query (50 elements again) ...
Who's stopping us from doing our own research :) ?
I'm hampered by my illiteracy in MQL5 - I can mislead everyone because of a mistake in the code, but your professionalism would inspire more confidence in such studies!
All you need is to executeArraySetAsSeries('our array',true) after getting the array (after calling iMAGetArray).I mean do it in a function at once?
In such cases, it's better to make several queries. For example, the first request - 50 elements, and, if necessary, the second request (50 elements again) ......
I.e. do it in a function at once?
...
It's better to flip the array in:
Vladimir Karputov:
After receiving the array (after calling iMAGetArray), you will have to executeArraySetAsSeries('our array',true).
...
Brr... I.e., put a loop in the loop? Why 50 and not 100? All the same, studies on this topic are necessary, maybe there is no sense in getting information about more than one bar...No nested loops - there will only be one loop around all values: all processing is sequential - search result in a separate function (in it, we request a certain value - for example, 50 values). If we don't find the result, we make a new request.
Working with indicators in MQL5 after MQL4 is terrible! It really makes me sick.
I don't understand why they can't combine everything in one function, including the handle, instead of smearing the call of the indicator all over the code!
And if an indicator settings will be changed by the function where the indicator is located, I don't understand what to do!? Do I need to initiate all variants of the indicator?
i saw an example in MQL4 - how to do it in MQL5 ?
Can you tell me how to remove the markers after closing a position so that they are not displayed?
Is it possible to remove them programmatically?
Thank you!