Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 504
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
Need to find the maximum value of the indicator over 15 periods. Searching in bars is not a problem, but in an indicator?
I will assume that for this you need to make a check loop, declare an array and find this value in it. The loop is done, but I don't know how to declare the array.
And then use the ArrayMaximum function to find the value? Can you tell me how to accomplish this task?
Hello!
Can you tell me how to make a condition -
if there is enough free margin to open a position?
(So that error 131 doesn't pop up)...Thanks!
https://docs.mql4.com/ru/account/accountfreemargincheck
Need to find the maximum value of the indicator over 15 periods. Searching in bars is not a problem, but in an indicator?
I will assume that for this you need to make a check loop, declare an array and find this value in it. The loop is done, but I don't know how to declare the array.
And then, I will use the ArrayMaximum function to find the value. Please, advise how to complete this task.
You don't just need an array, but an indicator buffer. In the main loop, fill the buffer with indicator values and use ArrayMaximum() to this buffer.
The search is necessary for the Expert Advisor. Will an indicator buffer work with it?
There is no indicator buffer in the EA.
If in the EA, then there are two options:
1. Do everything in the indicator, the EA calls the indicator and gets a ready value.
2. Make a loop in the Expert Advisor. But in this case, the array is not needed at all.
The Expert Advisor has no indicator buffer.
If in the EA, then there are two options:
1. Do everything in the indicator, the EA calls the indicator and gets a ready value.
2. Make a loop in the Expert Advisor. But in this case, the array is not needed at all.
An array will be needed. To find the minimum. The minimum will not be found in this way.
So you know exactly and are absolutely sure? There is no need to refute your opinion? Would you prefer to stick with it?
Hello!
Can you tell me how to make a condition -
if there is enough free margin to open a position?
(So that error 131 doesn't pop up)...Thanks!
So you know for sure and are absolutely certain? There is no need to refute your opinion? Would you prefer to stick to it?
Of course I do! Well, how do you apply this construct to finding the minimum? I can't get my brain around it)
It comes out -1.And I want to learn how to declare an array. I tried it this way:
You need it, of course! Well, how to apply this construction to search for the minimum? I can't do it with my brain)
To find the maximum, the variable val is assigned a value of 0 (obviously less than any of the indictor values).
This means that to find the minimum, we must add a deliberately higher value. The EMPTY_VALUE constant can be used or the indicator value directly on some bar among which the minimum is searched.
Or like this: