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

 
elibrarius:

I think that the number of deals does not need to be counted here. And just subtract the spread with the commission from each deal. That's how it is:

That's not how it works, you have to count anyway

 
Vladimir Perervenko:

Yes, yours is more correct.

No) yours is more correct!

Because the deal that was opened "earlier" (the opening did not fall into our vector)

it means that the commission was withdrawn "earlier" but not in the current vector

but these are minor details...

 

For those who have two hours of time


 
mytarmailS:

for those who have two hours of time


What's it about?

 
mytarmailS:

For those who have two hours of time


Cramming the brains of young people with his schizoid fantasies and false conclusions.

 
mytarmailS:

No) Yours is more correct!

because the deal that was opened "earlier" (the opening did not fall into our vector)

it means that the commission was withdrawn "earlier" but not in the current vector

but these are all insignificant trifles...

These are really trifles, if we do not take into account two points. The first is the speed of execution:

cnt<-function(x){
    n <- 1:(length(x)-1)
    cnt <- 0
    for(i in n) {if(x[i]!=x[i+1]) {cnt<-cnt+1}}
    return(cnt)
}
cnt1 <- function(x){
    length(rle(c(x))$values)
}

sig <- rep(c(1,1,1,-1,-1,-1), 3000)

bench::workout({
    c <- cnt(sig)
    c1 <- cnt1(sig)
})
# A tibble: 2 x 3
  exprs            process     real
  <bch:expr>      <bch:tm> <bch:tm>
1 c <- cnt(sig)     15.6 ms   9.21 ms
2 c1 <- cnt1(sig)        0   1.15 ms

The second option is 15 times faster. And if it takes part in a fitness function, which is called tens of thousands of times, it will lose a lot of time.

Second point. Everything is good if we have two conditions Buy/Sell. But as a rule, the TS generates three signals - Buy/Sell/hold (1, -1, 0). And then the second option does not work. And the first variant with a slight modification

sig <- rep(c(1,1,1,-1,-1,-1,0,0,0), 3000)
> length(sig)
[1] 27000
cnt<-function(x){
    n <- 1:(length(x)-1)
    cnt <- 0
    for(i in n) {if(x[i] != x[i+1] & x[i+1] != 0) {cnt<-cnt+1}}
    return(cnt)
}
bench::workout({
    op <- cnt(sig)
    op1 <- cnt1(sig)
})
# A tibble: 2 x 3
  exprs             process     real
  <bch:expr>       <bch:tm> <bch:tm>
1 op <- cnt(sig)     31.2 ms  17.43 ms
2 op1 <- cnt1(sig)        0   3.23 ms
> op
[1] 5999
> op1
[1] 9000

The first variant will show the correct result (although slow), and the second will consider exit from position as a deal, which is wrong.

 
Vladimir Perervenko:

These are really little things if you don't consider two things. The first is the speed of execution:

I agree completely...

Are there any ways to train networks or forests with fitness function ?
 
mytarmailS:

agree completely...

Are there ways to train a network or a forest with a fitness function ?

The fitness function calculates the value of the optimization criterion during the optimization process. It has nothing to do with model training.

 

We need to spar multiclass catbust in the metaq to add "do not trade"

the range of strategies will increase

 

I have inserted a new function in the fitness function to calculate the balance and take into account the commission...

I think that now the algorithm is trying to minimize the number of deals to save the commission... as a result less trades result in less experience...

Here are the charts, you can see that when there are few trades in training, then the training is not working ...

in gray, this is the TRAIN 1500 pips

the black is the 500-point TEST.

This was a small number of trades, the algo did not learn anything, very infrequent ...


It's fun to know entry points 2 days in advance ))

But it's probably better to retrain constantly, I do not know how to test it all yet

Reason: