Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1083

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
So it's a static array
So, in fact I write directly - self-taught, not far in understanding of subtleties of perception of programmer's being (And the theme is called: Any question of a beginner...). I give an example, that will not be reproached that all want to get for free, without effort, and on the other hand trying to clearly define the task (not to say that we can not read minds of others).
Once again, how to get the maximal value of indicator for the given amount of last bars from the given code or may be by the grace of understanding in the personal statement of coding?
With sincere respect, deference and understanding that programmers are people from another world and such a delicate explanation is not the fact that all of the above will have to be outlined again, perhaps more than once to get the desired result.
I searched all I could but i couldn't find any solution, last hope on you guys :)
The general task was to make an indicator, which, when thrown on a chart, i.e. it is already working, we press the specified key and the trend line (date1=date2, price1=price2) appears under the current cursor position
The problem arose when I can't getif(id==CHARTEVENT_MOUSE_MOVE) to pass the coordinates of the pointer toif(id==CHARTEVENT_KEYDOWN), and the code below also does not want to pass them. I don't know how to do it, but there is another variant, but it also has a problem. Maybe somebody knows, when you throw the indicator on the chart, the initial menu appears.
So, in fact I write directly - self-taught, not far in understanding of subtleties of perception of programmer's being (And the theme is called: Any question of a beginner...). I give an example, that will not be reproached that all want to get for free, without effort, and on the other hand trying to clearly define the task (not to say that we can not read minds of others).
Once again, how to get the maximal value of indicator for the given amount of last bars from the given code or may be by the grace of understanding in the personal statement of coding?
With sincere respect, reverence and understanding that programmers are people from another world and such a delicate explanation is not the fact that all of the above will have to be outlined again, perhaps more than once to get the desired result.
So reverse the loop and that's it.
From rates_total-1 to rates_total minus the desired_number_of_balls. If in EA, from Bars()-1 to Bars() minus...
I searched all I could but i couldn't find any solution. I have no hope for you guys :)
The general task was to make an indicator, which, when thrown on a chart, i.e. it is already working, we press the specified key and the trend line (date1=date2, price1=price2) appears under the current cursor position
The problem arose when I can't getif(id==CHARTEVENT_MOUSE_MOVE) to pass coordinates of the pointer toif(id==CHARTEVENT_KEYDOWN), and the code below also does not want to pass them, I don't know how to implement it, there is another option, but it is also a problem, if anyone knows, when you throw the indicator on the chart the initial menu appears, so can I lock it somehow, so that the indicator will appear on the chart immediately?
Pay attention to the variable visibility.
I haven't delved into it deeply, but I noticed that the variables are declared inside the condition. This should not be the case.
Pay attention to the visibility of variables.
I haven't delved too deeply, but I noticed that the variables are declared inside the condition. This should not be the case.
So that's the problem, how to make variables to be passed from one if to another, tried many variations, doesn't want to work...
You can read it here.
What many variations? Global level variables are visible in any part of the program, this is an extreme case.
Read it here.
What are the many variations? Global level variables are visible in any part of the program, this is an extreme case.
Good afternoon, gentlemen.
Question on arrays. How to find the largest value of the indicator on the required number of last bars of the chart, and not the first?
It has been discussed many times (I cannot find it), but I have rarely used arrays.
Could you advise how to solve the problem with indexing, perhaps by using ArrayMaximum(array) in a more elegant way?
If there's an elementary mistake somewhere, I'm sorry, I'm self-taught.
The flow of bug fixes in MQL4 builds never fades, sothe simpler the code, the more reliable it is .
Amax=-10000;
iAmax=-1;
for(int i=0;i<size;i++) {
if (array[i]>Amax) {iAmax=i; Amax=array[i];}
}
if (iAmax<0) ...something is wrong