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

 
Hello! I'm new to machine learning and I have a question, why do you all try to predict the direction of the price, either by zigzagging or simply by incrementing the next candle, there is a lot of chaos in the market, you should include in the prediction a corridor in which the price could "wiggle". It seems to me that it would be more efficient to take trading results as a target. For example, during training we consider an ideal income curve and the target will be marked as not deviating from the ideal by more than 15%, or another option, take the recovery factor and it should not fall below n , such targets will be more flexible for market data. And the most interesting thing is how to implement a function in this form for example for the same random forest?
 
mytarmailS:
Hello! I'm new to machine learning and I have a question, why do you all try to predict the price direction, either by zigzag or simply by increment of the next candle, there is a lot of chaos in the market, you need to include in the prediction a corridor in which the price could "walk". It seems to me that it would be more efficient to take trading results as a target. For example, during training we consider an ideal income curve and the target will be marked as not deviating from the ideal by more than 15%, or another option, take the recovery factor and it should not fall below n , such targets will be more flexible for market data. And the most interesting is how to implement a function in this form, for example, for the same random forest?
Hello, can you draw this target graphically to make it clearer?
 
 

Hello!

The left side is just a type of price, the right side is a curve of ideal balance (all that could be earned), green indicates a certain range (corridor) from the curve of ideal. balance, which we should not go beyond in their trade, gray indicates a balance type of real trade)

So the essence of the target is not a price prediction and the target in the form of a vector 11100001111100 , and finding a certain state in which the gray line will not go beyond the green

I don't know how to do it myself, that's why I would like to discuss it.)

 
mytarmailS:

Hello!

The left side is just a type of price, the right side is a curve of ideal balance (all that could be earned), green indicates a certain range (corridor) from the curve of ideal. balance, which we should not go beyond in their trade, gray indicates a balance type of real trade)

So the essence of the target is not a price prediction and the target in the form of a vector 11100001111100 , and finding a certain state in which the gray line will not go beyond the green

I do not understand how to do it myself, that's why I would like to discuss it.)

The slope angle of the line when trading in error will be less than ideal. You have depicted trading in gray, where most likely increasing the lot is making a return to the planned angle.

In other words it is trading to predict the price direction, but when the error is accumulated the system somehow starts to work on the plus side more often.

We have discussed three target options here.
1) closing of a deal in time interval
2) closing of a deal when the level is broken (tp/sl)
3) the general trend direction where the deal closing is not explicitly defined. It may be by time or tp/us.

Variant 3 is the most indistinct in terms of exit criterion.
 
Alexey Burnakov:
The angle of slope of the line when trading with errors will be less than ideal. You have depicted a gray line trade where increasing the lot most likely returns to the intended angle.

That is, it is trading to predict the price direction, but when the error is accumulated the system somehow starts to work in the plus more often.
I don't get it )) there is no lot, there is no system that works hard), it's a randomly generated date... Just pictured which should work better than the zigzag in my humble opinion of course, but how to implement this I do not know, thought someone might tell
 
mytarmailS:
I don't get it )) There are no lots, there is no system that works enhanced), it's randomly generated date... I just imagined a target which should work better than the zigzag in my humble opinion of course, but how to implement it I do not know, I thought maybe someone would tell me

I can't understand you either.

Your gray curve is like trading with a variable lot to always come back to a line with a high slope.

It's like a martin that always has one angle of the trading line.

In reality, it is not realistic to trade this way. With mistakes (losing trades) your real curve will be much closer to zero.

How the target is realized is also not clear. This type of time series is possible only when the trade returns always in the plus position after accumulation of losses. It is hardly possible to put it into training, at least in the standard way.

 

It's not a system, it's just an illustration))) There is no trade there.

Sorry, I must be bad at expressing my thoughts

here is the code

PRICE <- cumsum(rnorm(200))+1000

par(mfrow=c(1,2))

plot(PRICE,t="l",,lwd=2)

PD <- c(0,diff(PRICE))

BAL <- PD

for (i in 1:length(PD)){

if(BAL[i] < 0) BAL[i] <- BAL[i]/-1

}

BAL <- cumsum(BAL)

lowBAL <- BAL - 50

plot(BAL,t="l",lwd=3)

lines(lowBAL,t="b",col="green")

realBAL <- BAL+rnorm(200,sd = 20)

lines(realBAL,t="l",col="grey")


Let's start over, there is a standard target function, it is a vector that indicates the direction of movement, you can describe it by a zigzag or just the next candle close, the vector is usually converted into 1110000111 or -1-1-11111

I can do it that way, but I think such approaches are flawed.

I propose to do so: let the algorithm during training how to simulate their trade (gray chart) and compares it with the ideal return, which could beat (black chart) that is, the algorithm does not try to predict the next price and just tries not to go beyond the green line. That's all I tried to show on the chart.

Question: is it possible to implement it, because all algorithms that I saw (neural, RF...) want as a target vector of 11100011

 
mytarmailS:

It's not a system, it's just an illustration))) There is no trade there.

Sorry, I must be bad at expressing my thoughts

here is the code

PRICE <- cumsum(rnorm(200))+1000

par(mfrow=c(1,2))

plot(PRICE,t="l",,lwd=2)

PD <- c(0,diff(PRICE))

BAL <- PD

for (i in 1:length(PD)){

if(BAL[i] < 0) BAL[i] <- BAL[i]/-1

}

BAL <- cumsum(BAL)

lowBAL <- BAL - 50

plot(BAL,t="l",lwd=3)

lines(lowBAL,t="b",col="green")

realBAL <- BAL+rnorm(200,sd = 20)

lines(realBAL,t="l",col="grey")


Let's start over, there is a standard target function, it is a vector that indicates the direction of movement, you can describe it by a zigzag or just the next candle close, the vector is usually converted into 1110000111 or -1-1-11111

I can do it that way, but I think such approaches are flawed.

I propose to do so: let the algorithm during training how to simulate their trade (gray chart) and compares it with the ideal return, which could beat (black chart) that is, the algorithm does not try to predict the next price and just tries not to go beyond the green line. That's all I tried to show on the chart.

The question : is it possible to realize it, as all algorithms that I've seen (neural, RF...) want a target vector of 11100011 in the form of a target vector ?

Thank you. I understood you right away. It's just that it's not implemented in the standard way.

Take random forest. I assume you are familiar with this machine learning method.

This thing can only work one way. If we have a binary output variable, the decision forest for each of the inputs will just stupidly look for a region of values where the skew of one of the output class is statistically larger. And iteratively this is done for all variables.

If you want the machine to account for the deviation of real trade accuracy from the ideal, you need to make sure that the decision forest is chosen accordingly, not based on skewness in the classes. At the same time, you need to take into account the dynamic variation of the deviation of the ideal trade, which is also not realizable by the standard. For this purpose it is necessary to feed the machine with data on perfect trade in dynamics. For this purpose it is necessary to re-write the method. Standard tools simply cannot do it.

There are gradient functions. For a standard forest, the gradient is set in its own way. If you need to optimize the deviation of the trade from the ideal, it will be a completely different gradient. I somehow don't think I can personally write it right on my knee.

 
Thanks for the clarification, now I understand you perfectly, and genetic algos can help here? instead of RF, I have quite a few interesting ideas for implementing the target, I would like to try them.
Reason: