![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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. Let's take a currency pair for study. Let it be EUR/USD.
First of all, let's analyze the ranges of price changes within a fixed time interval, for example, a day. Using the
script, that calculates the mean value of the pair changes in points within a day (for example, Average Range by Igor Kim) we obtain the value of 97 points
in the interval from 03.01.2005 to 31.03.2008.
Generally speaking, it would be better to calculate the distribution of changes from the lowest value
to the highest one, rather than to obtain the average value. But, unfortunately, I don't have such a tool at my disposal.
What does this value give us? Let's use it as a basis for estimating flat and trend sections.
I should point out that there are many variants of estimation, therefore I won't bore you with their enumerations, I'll go to the most acceptable variant, from my point of view.
For this purpose, we will use the ZigZag indicator with its channel. I will not go into details of ZigZag rules. Let us set the channel width
of ZigZag equal to 100 points (close to 97 points). To estimate a flat/trend, we will need to draw lines similar to ZigZag lines
connecting extrema, but at points exactly on the opposite borders of the channel. See Fig. 1.
Now the main point.
If the slope of the ZigZag line and the line plotted by us coincide, it is a trend,
if it does not coincide, it is a flat.
The colour of the section name (flat, trend) matches the colour of lines drawn using this rule.
Fig. 1.
Why are these conditions chosen?
Actually it means that if we opened a position on the channel border in flat (on a rebound), we would breakeven until we reached the
the opposite side of the channel and vice versa (breakout) in the trend range.
Now it is "a matter of technique" to measure the time periods of the flat and trend and compare them with each other. Like with the daily range, it is more correct not to just
to sum up the values obtained, but to get a distribution. In doing so we will get additional useful information (e.g. maximal
value in points or in time for a given parameter, etc.).
It would be interesting to see how the ratio would change with other parameters (channel width). When saving lines from Fig. 1
the width in Fig2 is doubled (200pp) on the selected interval, in Fig3 it is reduced to 60pp .
I would like to note that this definition of a flat and a trend does not give us the possibility to determine the current market situation
.
and even less so for the future. It can be applied only to quotes history.
Fig2Fig3.
As we can see the number of plots has changed. But how will their percentage change at the examined (large) time interval and will it
correlate with the obtained value as the main one, we will be able to find out by conducting this research.
I wanted to write conclusions and possible ways of using the information and data obtained, but I decided that people here are literate and everyone
conclude on the usefulness of the material and possibly the data obtained in the future, as well as their need for themselves.
Those who have programming skills and are interested in this topic, please respond to solve this useful task for many traders.
Well, now there's a subject to talk about.
All that's left to do is provide a link to the ZigZag code with its channel.
Still, it would be interesting to know what was your trading strategy. It is really impossible to predict the price movement on the given drawings.
Well, now there's a subject to talk about.
All that's left to do is provide a link to the ZigZag code with its channel.
I have such a variant. Unfortunately, when switching the TF, the lines connecting extrema are not always displayed correctly (they drift somewhere). (Sometimes it happens during scrolling through the history as well) However the channel is always displayed correctly.
You really cannot predict the price movement based on the above drawings.
1. personally, I firmly and deeply believe that trying to predict the price is the deepest delusion (of all times :-)) actually no joke
2. The above drawings do not reflect the TS in any way, although the analogy is there
3. TC is a topic for a separate study. I suggest if you are interested in discussing it later.
Here's an outline of the script. The results, by the way, are interesting ;)
External parameters - indicator parameters (it should be in MT4\indicators folder).
The script draws trend lines (green-red)/flat lines (white) and displays basic statistics (number of trend/flat sections, their total length in bars and in % of the entire history).
Here's an outline of the script. The results, by the way, are interesting ;)
The script draws trend lines (green-red)/flat lines (white) and displays basic statistics (number of trend/flat sections, their total length in bars and in % of history).
Super speed, of course! One can only envy it. I spent much more time on the description..... and how much more time to go.....
I just can't seem to get a handle on the graphics :-(.
... Be consistent already, Andrei. Make the distribution according to Average Range (only as a wish)
Super speed, of course! One can only envy it. I've spent a lot more time on the description..... and how much more to do.....
Be consistent already, Andrei. Make the distribution according to Average Range (only as a wish)
Let's do it another way ;)
First describe everything you want to see and then I'll do it. So that I don't have to worry about it every hour...
Preferably, to each characteristic a calculation formula and a short explanation.
ps: how do you like the numbers? ;)
Let's do it differently ;)
First describe all you want to see, and then I will do it. So I don't have to worry about it every hour...
Preferably, each characteristic has a calculation formula and a short explanation.
I'll try, but it's not fast. I can't give descriptions at this speed .... I'm getting old...
ps: how do you like the numbers? ;)
Unfortunately, it does not stick to the chart. In the folder indics saved. Maybe what else you need?
Please post, at least in text, some of the results. I'm very curious.
Unfortunately, it does not connect to a chart. I have saved it in my indices folder. May I need anything else?
This is a script. It must be saved in the "MT4\experts\scripts\" directory. Then open and compile it (F5) or restart the terminal.
In the directory "MT4\experts\indicators\" the indicator that you posted should be located, the script uses it when calculating.