Bayesian regression - Has anyone made an EA using this algorithm? - page 17
![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
Reading about Bayes' work in popular science articles I came across the following problem.
"Suppose a barrel contains many small plastic eggs. Some are coloured red and some are blue. 40% of the eggs contain pearls and 60% are empty. 30% of the eggs containing pearls are coloured blue and 10% of the empty eggs are also blue. What is the probability that the blue egg contains pearls?"
At first glance, the probability seems small, as only 30 per cent of pearl-containing eggs are blue. In fact, on the contrary, the probability that the blue one contains pearls is 67%, twice the probability that it does not.
"40% of the eggs contain pearls and 30% of them are blue, so 12% of the eggs both contain pearls and are blue.
60% of the eggs do not contain pearls, and 10% of them are blue, so 6% of the eggs are blue and do not contain pearls.
12% + 6% = 18%, so the total proportion of blue eggs is 18%.
We already know that 12% of eggs are blue and contain pearls, so the chance that a blue egg contains pearls is 12/18 or about 67%."
Or according to Bayes formula: the probability that the blue egg contains pearls P(A|B)=P(B|A)*P(A)/P(B)=0.4*0.3/0.18=0.67.
P(A)= p(pearls) = 0.4 probability that the egg contains a pearl .
P(B|A)=p(blue| pearl) = 0.3 probability that the egg is blue if it contains pearls
P(B)=p(blue) = 0.18 probability that the egg is blue.
Replaced "barrel" with "chart", blue eggs are bearish candle, red eggs are bullish candle, pearls - more than 70% of price increments inside the bar are positive, or in short - many positive increments (MPP).
Suppose the red candlesticks are bullish, and the blue ones are bearish. 40% of the candlesticks have PPM and 60% do not. 30% of the candlesticks which contain MPP are bearish and 18% of all the candlesticks are also bearish. What is the probability that a bearish candlestick contains MPP.
Here, at first sight, the probability is even less: the same 30% of candlesticks which contain MPP are bearish and the candlestick itself is bearish, so it should contain more negative increments than the positive ones. But according to the calculations in this case we have the same 67%.
The probability of the bearish candlestick contains MPP. P(MPP|bear) =P(MPP)*P(bear|Bear)/P(bear)=0.4*0.3/0.18=0.67
P(A) = p(MPP)=0.4 probability that the candle contains MPP .
P(B|A)=p(bearish|MPP) = 0.3 probability that the candle is bearish if it contains MPP
P(B)=p(bearish) = 0.18 probability the candle is bearish.
In this case, if a candlestick has most positive increments, it needs more negative increments to become bearish. This is true for any distribution law of price increments inside the candlestick or for the lack of any.
Here's another thing I read:
"Psychological experiments[1] have shown that people often incorrectly estimate the probability of an event based on their experience(a posteriori probability) because they ignore the probability of the assumption itself(a priori probability). Therefore, the correct result according to Bayes' formula can be very different from the intuitively expected result."
You see, that's how it is.
...
In this case, if a candlestick has most of its increments positive, then for it to be bearish, the negative increments must be longer. This is true for any law of distribution of price increments within a candlestick, or for the lack thereof.
...
To come to this conclusion, was Bayes' theorem applied?
Incorrect estimation in probability problems may also result from an unattractive presentation of problem conditions.
The easiest way to shut my mouth is to show the workings of the polynomial model with this example....
And how many Reshetts have poked fun at you, and how many adepts (18) have died in the prediction thread...))
I wrote long ago that the market is a system that reacts to news. All these discussions about the statistical distribution of prices, volatility and regression errors are useless. If we take price behaviour at news release times (and those times are known and regular), we will get one distribution. If we choose times of night sessions we will get another distribution. Regression of market prices is also useless. The regression tail will wiggle and depend on the incoming prices. Use dashes if you need to smooth out the price series. Extrapolating a regression is utopia. Price is not a rock that is thrown and then you try to determine where it will be after a period of time. Applying rocket tracking algorithms doesn't work either. Although, focusing on the moments of news release (external shocks) and price tracking immediately after the shock does make sense. Regularities can be detected and profits can be made. But it is an error and theoretical "opium for the people" to consider the whole price series as a whole and talk about its averaged characteristics.
I remember you wanted to find a decent algorithm to check the impact of certain news on the markets.
My opinion about the news is that only very important and unexpected news change the market direction and the logic of price behavior that cannot be described by the rules of technical analysis. In all other cases, the news can affect the price movement, but the movement itself is technical and clear.
I remember you wanted to find a decent algorithm to check the impact of certain news on the markets.
My opinion about the news is that only very important and unexpected news change the market direction and the logic of price behavior that cannot be described by the rules of technical analysis. In all other cases, the news can influence the price movement, but the movement itself is technical and clear.
Was Bayes' theorem applied to arrive at this conclusion?
Incorrect estimation in probability problems may also be due to an unattractive presentation of the conditions of the problem.
Such a conclusion in this example may also be reached purely logically. But in my opinion, Bayes formula is correctly applied here. Although I can not vouch for this, because I study the issue from articles for "dummies".
http://baguzin.ru/wp/wp-content/uploads/2013/09/%D0%98%D0%BD%D1%82%D1%83%D0%B8%D1%82%D0%B8%D0%B2%D0%BD%D0%BE%D0%B5-%D0%BE%D0%B1%D1%8A%D1%8F%D1%81%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5-%D1%82%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D1%8B-%D0%91%D0%B0%D0%B9%D0%B5%D1%81%D0%B0.pdf
I wrote a long time ago that the market is a system that reacts to news. All this talk about the statistical distribution of prices, volatility and regression errors is useless. If we take price behaviour at news release times (and those times are known and regular), we will get one distribution. If we choose times of night sessions we will get another distribution. Regression of market prices is also useless. The regression tail will wiggle and depend on the incoming prices. Use dashes if you need to smooth out the price series. Extrapolating a regression is utopia. Price is not a rock that is thrown and then you try to determine where it will be after a period of time. Applying rocket tracking algorithms doesn't work either. Although, focusing on the moments of news release (external shocks) and price tracking immediately after the shock does make sense. Regularities can be detected and profits can be made. But it is an error and theoretical "opium for the people" to take the whole price series as a whole and talk about its averaged characteristics.
I wrote the Expert Advisor in 2011 and was ready to run it on real, but many forex firms in the US closed down, even Alpari.
Jesus!
When will you all start reading books?
Because you know what is known and you know what is not known!
You just have to sit down and read!
1. For starters, just try to understand the words we say:
TECHNICAL ANALYSIS.
Analysis, and then there is the word forecast - these words have different meanings and are not synonymous. People who know technical analysis are called chartists, i.e. people who draw charts. Nothing more. It is an ability of human psyche to perceive information in graphical form better than in digital. No more than that. True, there are people, very rare, who look at the drawn charts for a long time, 3-5 years, make decisions in the real world, and eventually trade profitably. You may be wondering, who is reading this, if you are a part of this category of people?
2 The fact that regressions cannot be applied to financial markets was known about 100 years ago. But those people were smothered by Markowitz in 1952, when he invented portfolio theory. He gave a mathematical apparatus that allowed him to balance profitability and risk. He even got a Nobel in 1992, despite 1987, when all portfolios collapsed as did Markowitz's theory.
Everyone remembered Mandelbrot's mid-1960 publications and started pointing fingers intensely at the tails of the distributions, because the events of 1987 are almost unbelievable, and it happened, as Mandelbrot predicted before the woes of 1987 20 years earlier.
Other people were remembered here - Box-Jenkins, who had proposed a model 15 years before the 1987 crash.
3. the ARIMA model. The authors of the model stated that it was impossible to use initial quotations, and that it was necessary to use incremental prices. This is how they got rid of trends. They gave a model and a methodology of its construction. It is still used in the U.S. Government. It is available to the public.
4. Almost immediately clever people noticed that ARIMA is a workable model, but in a very narrow part of financial markets. And they formulated: it is necessary to take into account changes in dispersion - these are a variety of ARCH models. These models have expanded the scope of matmethods.
5. Almost at the same time Granger invented his cointegration model, also got a noob. He said that ARMA, ARIMA, ARCH, GARCH and all the rest are not the same, but it is possible to combine two assets in such a way that a stationary result is obtained, and if so, all statistical methods, including regressions and appropriate analyses and forecasts start working perfectly. And it really works.
6. And then in 1998 and then in 2007 the idea of stationarity of financial series was remembered as dubious as the methods of reducing these financial series to a stationary form.
The ideas of artificial intelligence in the form of machine learning began to rise in which it was argued that one could predict the value (regression methods) or the direction(classification methods) of the target variable from the set of values of the input variables (predictors). In the case of classification: it is possible to predict a variable that takes two values: buy and sell. For lovers of TA: something like pattern trading, only the model is taught to recognise patterns and statistics are available.
PS.
The place of Bayesian models in financial markets is long and accurately defined - not applicable.
PSBP
There is an aphorism: correct models do not exist - there are useful models.
And usefulness is defined solely by the fact that a model applies only to data to which it CAN be applied.
...