Questions from Beginners MQL4 MT4 MetaTrader 4 - page 195
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
Find the point at which price crosses the MA upwards. This will be the start of the search range.
Find the point at which price crossed the MA downwards. This would be the stop range.
Take iHighest() only in this range.
And how to implement search for MA points, so that only 2 extreme points are searched and not to infinity. I understand it too, but if it's not difficult how to implement it in the code.
One way: create a variable at global EA program level (declare a variable in EA header) - in this variable write the opening time of bar at which the last crossing was made. This will help to use the third form of call ofCopyBuffer:
The reference of start and end dates of the required time interval
Here start_time is just the time from our variable, and stop_time is the time of the last known quote of the server.
And how to implement the search of points of the MA, so that it would look for only 2 outer ones, and not to infinity. In words I understand it too, but if it is not difficult how to implement it in the code.
You have to go through the loop until you find a move away from the MA.
One point, this section highlighted by the yellow rectangle, will interrupt the loop before it reaches the second crossover between the price and the MA. The maximum will be found at the first right crossover
P.S. What is the difference between the highlighted 2 areas?
P.S. What is the difference between the highlighted 2 areas?
They may be different - namely the first point may be higher or lower than the second point.
This is just an example. But it does not mean that they will always be identical.
Who can throw examples of code with similar conditions..:
Current value of MA> 0 bar.
Looking for Bar number, Price<MA, found number 1 bar, write value to buffer 2
Looking fornext number Price>MA found number 2 bar, write value to buffer 1.
Stop search.
Then between the values of buffer 1 and 2 look for the lowest price Low.
If Current MA value < 0 bar
Looking for the number of bar, Price>MA, found the number of 1 bar, write the value in buffer 2
Looking fornext number Price<MA found number 2 bar, write value to buffer 1.
Stop search.
Then between the values of buffer 1 and 2 we look for the highest price High.
They may be different - the first point may be higher or lower than the second point.
It's just an example. But it does not mean that they will always be the same.
Who can throw examples of code with similar conditions..:
The current value MA> 0 bar
We are looking for the bar number, Price <MA, we have found the number of 1 bar and we write the value into buffer 2
Looking fornext number Price>MA found number 2 bar, write value to buffer 1.
Stop search.
Then between the values of buffer 1 and 2 look for the lowest price Low.
If Current MA value < 0 bar
Looking for the number of bar, Price>MA, found the number of 1 bar, write the value in buffer 2
Looking fornext number Price<MA found number 2 bar, write value to buffer 1.
Stop search.
Then between the values of buffer 1 and 2 we look for the highest price High.
If we follow the image, we have to start a loop and search until the condition MA<Value is found.
Once this is found, we fill the array with High prices. We run the cycle until the condition MA>Price is found, as soon as we find this place - we break the cycle.
Well, in the array looking for peak prices
If you follow the image, you should run a loop and search until the condition MA<Value is found.
Once this is found, we fill the array with High prices. We run the cycle until the condition MA>Price is found, once we have found the place, we break the cycle.
Then we look for the peak prices in the array.
You're right and I also wrote it the same way, but how to implement it in the code, you can at least give us a code example of this :
start a loop and do a search until the condition MA<Price is found.
As soon as it is found,we fill the array with prices High
That's right and that's how I wrote it, but how to implement it in Code can you at least give a code example of this :
run a loop and do a search until the condition MA<Price is found.
As soon as this condition is found,we fill the array with prices High
I can't write the code now, maybe someone else will write it - it's simple
This is what is needed, can someone help with this code.
Then find next value where iLow>ma and return bar number No_2 .
Stop search and use iHighest function to find vertex between these bars
int val_index=iHighest(NULL,0,MODE_HIGH,No_2,No_1);
This is not MQL5 code.
This is not MQL5 code.
This is a layout, there is no difference between 4 and 5
:)