Machine learning in trading: theory, models, practice and algo-trading - page 287

 
Dr.Trader:

I still need to study a lot to somehow maintain a conversation with you on this subject... And you don't have to use neuronics, you can also use Forrest, it's easier to attach the target

 
Dr.Trader:
...

In general, everything, but there is a nuance - those optimizers that I have tried can not cope with weights, they just find some local minimum when all the results will be equal to 0.5 to minimize the average error, and stuck at this point. You need to apply some kind of trick here, I have not progressed any further.
The more complex is the structure of neuronics - the more weights there will be, and the harder it is for the optimization algorithm to find them, on large neurons they just keep getting slower and almost do not improve the initial result.

Didn't you, not so long ago, in a thread where MT optimizer was discussed, demonstrated your super-algorithm on R? Doesn't it work?
 
Dr.Trader:

The answer is not so simple. Here's one way, for example, with a neuron, but you need to understand how the neuron works, what formulas it has, etc.

Suppose there's a simple neural network...

код

The code above can be shoved into the optimizer...

What a story you tell)))

Why didn't you like backprop, if it's not a secret? More precisely, in the case of one layer and one target, everything is greatly simplified, iteratively you need to subtract the error multiplied by the intput to convergence from the weights, delta rule is called, or Heb rule, I don't remember exactly. Wt = Wt-1 - lernrate*error*Input, in general the usual gradient descent

 
Andrey Dik:
Wasn't it you, not so long ago, in a thread where MT optimizer was discussed, demonstrated your super-algorithm on R? Doesn't it work?

Me, yes, no.

I'mnot so sure:

What's wrong with backprop, if it's no secret?

I can gradient descent, but it requires targeting to each specific training example - consider the result for the training example, and yank the weights in the direction of the derivative to get the result closer to the real one. And so one by one on all training examples.

This code was an answer to the question what to do if you don't have a target and just want to teach your neuron to trade on the profit side. Let it sort out by itself where it's better to buy or sell as long as the profit is profitable.
So we give it ohlc increments on the bars, get predictions of what to do on the next bar, simulate trading based on predictions and find the trading ratio. This ratio shuffle is the only estimate that is given to the neuron on the whole set of input data.
The optimizer will optimize neuronka weights so that the ratio sharpe grows.
If you find gradients of weights with respect to sharpe ratio, you can do gradient descent, it will be much better than blindly change weights.

 
Dr.Trader:

Me, yes, no.


Among the hundreds of thousands of packages in R, isn't there one that does the job with satisfactory results?
 
Andrey Dik:

Among the hundreds of thousands of packages in R, is there really no package that can do the job satisfactorily?

There are packages that are guaranteed to solve this problem, but I don't have time to wait months for a result, I ideally need to get it done in one weekend.
This technology is not for the home computer.

 
Dr.Trader:

There are packages that are guaranteed to solve this problem, but I don't have time to wait months for a result, I ideally need to get it done in one weekend.
This technology is not for the home computer.

Reminds me of an old motorists' joke:

- Doesn't the car start well?

- No, it starts fine, but it takes a long time.

If the technology does not allow to solve the problem in an acceptable time, it means that there is no technology.



How many parameters to optimize, in what range, and with what step should you optimize?
 

downloaded historical buyers vs. sellers balance data from onada herehttps://www.oanda.com/forex-trading/analysis/historical-positions

plotted and calculated the correlation of balance to price

oanda <- read.csv("C:/User................OANDA_historical_position_ratios_data_EUR_USD.csv")

layout(1:2)
plot(oanda$price ,t="l" , main = "EUR")
plot(oanda$pct_long ,t="l" , main = "balanse",col=2)
abline(h = 50)

cor(oanda$pct_long  , oanda$price)

fy

the correlation coefficient is -0.76

It is interesting to note that the price moves in the opposite direction even not relative to the balance in its absolute values but relative to the dynamics of balance change...

Exactly the same mechanics is present at other highly liquid markets, this balance can be seen in other ways, for example in the market glass. I am sure many people know it, I admit that I myself have known for probably 6 years, but I wrote it for those who did not know, it will be useful and interesting.

If balance makes the market go round, maybe it's better to predict the balance instead of the price. Anyway, price forecasting in trading strategies is nothing else but forecasting of traders' actions in the future, no matter how banal and trivial it sounds, but when you start to think how you can forecast the crowd, it's more interesting now.... I think to understand a crowd you should first understand yourself, because we are a crowd... How can you calculate the crowd? What are your thoughts?

Historical Forex Position Ratios | Currency Trend Analysis | OANDA
Historical Forex Position Ratios | Currency Trend Analysis | OANDA
  • www.oanda.com
The following graph shows the historical trend of long-short positions on fxTrade platform alongside the market price for the selected currency pair and time period. Note the Net Position graph is calculated by subtracting the percentage of short positions from long positions. For example, a net position of +20% for EUR/USD means percentages of...
 
SanSanych Fomenko:

For some reason the conversation constantly slips into a discussion of the advantages and disadvantages of certain models.

Even though not much of my experience tells me that the contribution of the models themselves to successful trading is extremely insignificant.

The definition of a target and its predictors is decisive.

On the example of ZZ, I tried to show many times that even so obvious, illustrative and beautiful target variable as ZZ is not the same and at a closer look it hides insurmountable obstacles.

If we talk about predictors, it is quite obvious to me as a person who was engaged in economics all his life that:

  • the predictor must be relevant to the target variable - predictive ability for the target variable
  • the predictor must be ahead of the target variable

If one concentrates solely on solving these two fundamentals for economic and forex prediction, then success will only come from these two parameters. And selecting the best-fitting model to the target and its predictors can only marginally improve the performance, can give some valid considerations about the lifetime of the model without re-training.


Once again, I urge you to focus on the target variable and the justification of predictors for that particular target variable.

Agreed.

 
Dr.Trader:


And this code was the answer to the question what to do if the goal is not defined, and you just want to teach the neuron to trade on the plus side. Let it decide by itself where it is better to buy and where it is better to sell - if only profits would be positive.
So we give it ohlc increments by bars, get predictions of what to do on the next bar, simulate trading based on the predictions and find the trading ratio. This ratio shuffle is the only estimate that is given to the neuron on the whole set of input data.
The optimizer will optimize neuronka weights so that the ratio sharpe grows.
If you find gradients of weights with respect to sharpe ratio - you can do gradient descent, it will be much better than blindly change weights.

To be honest I haven't tried it, for some reason it seemed at once as some alchemy, not a very good idea, for single-layer perseptron with small number of instances it may be and something will be terribly slow, multilayer one will not work, IMHO it is of little use. Besides the profitability of TS depends directly on forecasting of total return for N bars ahead, it's impossible to correct bad forecasting, to optimize an entire strategy is much more risky to deceive yourself.