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
I absolutely agree with others that flat is an abstract concept. The usual approach to this problem is as follows:
1. We write two Expert Advisors, one for trading on the flat, the other - on the trend.
2. Add different filters of loss trades to both EAs and optimize their thresholds in order to increase the balance. These filters of loss trades will be YOUR (and only YOUR) conditions for trend and flat
3. Combine the two EAs in one, and off you go!
A more correct and vital question would be: What filters of losing trades can be used for trends or flat (they are different)?
OK... Then let's ask this: "Which filters of losing trades can be used in a trend or flat (they are different)?
How do you programmatically define a flat?
Retrospectively is very simple. If price has travelled in a certain direction more than it has travelled in less time during t1, then the trend is in that direction. There are a lot of practical realizations, starting from Hearst and up to the Dow with its rising local lows. But this is a fait accompli, while in practice a simple Close[0]-Close[t] price difference can also be useful.
Retrospectively is very simple. If price has moved in a certain direction more than it has moved in shorter intervals during t1, then the trend is in that direction. There are plenty of practical implementations, from Hearst to the Dow with its rising local lows. Only this is all a fait accompli, and in practice a simple Close[0]-Close[t] price difference can also be useful.
there... something to the point!)
There is a Bollinger Bands indicator (trend indicator).
BandCur=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,0);
BandPr=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,30);
To determine the trend
If (BandCur<BandPr)
Print("Trend Down");
else
Print("Up");
And for the flat there is iBandsOnArray() (https://docs.mql4.com/ru/indicators/iBandsOnArray)
How do you programmatically define a flat?
Actually, it won't do anything. Trend and flat, as previously stated, can be detected by Aligator. The question is: what is it for?
If it's for trading, it won't work! The probability of a price pullback when a trend is emerging is 50/50. You can pick the MA for a certain period, but in the future I'm not sure it will work (maybe a week, but not for long, because the market is very volatile).
But this is just my way of thinking about life :)) And if business - Force Index indicator is not bad in such cases. Flashes of activity can be clearly seen on it, and on the quiet segments (close to 0) the price, though going in a certain direction, fluctuates in the flat. I like it very much.
I have an idea how to define a flat, but how to write it programmatically?
If the width of the horizontal channel (high and low) during the last n bars does not exceed m points, then this is a flat.
If the width of the horizontal channel (high and low) during the last n bars does not exceed m points, it is a flat.
There are several methods in statistics for identifying the trend in a dynamic series (for example: the Foster-Stewart method). Unfortunately, they do not give a reliable result in forex due to the fact that dynamic series of currency pairs are characterised by catastrophic changes.