![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
Experts can work simultaneously - each with its own wizard, and recognition of market conditions and resetting should be in every expert. If this condition is not met, when the market situation changes, losses are inevitable, because the targets and stops should be different in a flat and a trend. Besides, we should consider intermediate conditions - the low flat, or "slippage" with low activity. Basically, the set of profitable Expert Advisors should show the best results due to locking of losing Expert Advisor positions.
Almost everyone has its own realization. But many EAs do not have error correction. I certainly don't. I just try to avoid them. If we do something standard, we should allow for that. I would add a symbol() to magician, although it may be unnecessary. Theoretically, an order with one ticket cannot be repeated, although it may be.
Yes, of course. That's exactly what I did in the code. In the external parameters we also set Magic _n, and each version with its own magician will work according to its own algorithm.
On trend detection. The ProtoType-IV Expert Advisor provides an example for a multi-currency Expert Advisor that identifies a trend by four last extrema. I have scrupulously penetrated into it and "half-heartedly" allocated this bit of code and now it can be inserted into any Expert Advisor. If necessary. If you set it in external parameters
Here is the "qualifier" itself:
The graph in the corner shows the function=0,, or =1, or=-1
I didn't just post the code for trend detection, though. Another idea came up...(I'll explain it later)
Maybe this indicator will work for starters:
On the chart iPeriod=20, MASoot=20
I have not got into its work. But in visual mode it's easy to see how it works...
In my opinion, it is more convenient to define the trend using linear regression, the script of linear regression from MT-4 standard set is very good, I would like to make an indicator based on it, may be somebody knows where to get the source code? All known implementations do not work well with price trend. I need a channel of set length from 1 to N bar with recalculation when a new bar appears and the possibility to output its width in pips and its slope in pips to the length. It would be nice to have the same channel of standard deviation with the given deviation. We can start from scratch, but if someone has a source from MT it would be much easier.
I've posted it somewhere before. I can post the new version. One error has been fixed.
And here is the indicator.
The number of bars is displayed on the screen. 3 sigmas are displayed. If the price is within one SCO, recalculation is not performed, as everything is in permissible limits. When the price breaks through it, it will be recalculated.
Vinin , your channel is very decent and adjusts correctly. Thank you. I'll share one idea about the filter for the flat. We all remember Rev. Reshetov and his perceptrons. In principle a perceptron is a linear filter. I want to try to filter the fllet with a perceptron. I want to input width and slope of 2 linear regression channels of different length, Bolinger width and price change rate. I think what to use as an optimization criterion. Perhaps a rebound from the Bollinger Boundaries to the inside - with the target of 75% of the width.
Vinin , your channel is very decent and adjusts correctly. Thanks, I'll share one idea about the filter for the flat. We all remember Rev. Reshetov and his perceptrons. In principle a perceptron is a linear filter. I want to try to filter out flying by perceptron. I want to input width and slope of 2 linear regression channels of different length, Bolinger width and price change speed. I think what to use as an optimization criterion. Perhaps a rebound from the Bollinger Boundaries to the inside - with the target of 75% of the width.
Reshetov's perceptron will not do. We should make a Kohonen layer of at least 4-5 non-Roynes. But there will be only one problem - all values must be of the same order.