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

 
mytarmailS:

Please help me understand...

What the hell is going on? Everything seems to be right, is it a bug or something?

===============================================================

Below is an example of getting (one of the possible!) what you need. Although it is not clear why you need it? Or I don't understand your question?

X <- rep(0,1000)
Y <- rep(999,100)
dat <- sample(c(X, Y))
table(dat)
0  999
1000  100
#Возьмем последние 100 значения вектора dat
s <-tail(dat,100)
# Определим индексы этого куска
# в которых Значения не = 0
which(s!=0)
[1]  2  6  9 11 19 20 21 35 36 43 51 59 80
[14] 90 98
# Проверим визуально
> s
[1]   0 999   0   0   0 999   0   0 999   0
[11] 999   0   0   0   0   0   0   0 999 999
[21] 999   0   0   0   0   0   0   0   0   0
[31]   0   0   0   0 999 999   0   0   0   0
[41]   0   0 999   0   0   0   0   0   0   0
[51] 999   0   0   0   0   0   0   0 999   0
[61]   0   0   0   0   0   0   0   0   0   0
[71]   0   0   0   0   0   0   0   0   0 999
[81]   0   0   0   0   0   0   0   0   0 999
[91]   0   0   0   0   0   0   0 999   0   0
# Запишем все это красиво
require(magrittr)
# Преобразуем вектор в матрицу
d <- matrix(dat, ncol = 100, byrow = T)%>%
# пройдемся по строкам и определим индексы
# ненулевых значений  
  apply(., 1, function(x) which(x != 0))%>%
# пройдемся по списку и отберем последние
# три индекса
  lapply(., function(x) tail(x, 3))%>%
# преобразуем список в вектор
  unlist()%>%
# преобразуем вектор в матрицу
  
matrix(., ncol = 3, byrow = T)
> d
[,1] [,2] [,3]
[1,]   64   72   93
[2,]   66   79   84
[3,]   73   87   92
[4,]   62   85  100
[5,]   94   97   98
[6,]   83   93   94
[7,]   52   65   74
[8,]   63   70   99
[9,]   61   62   79
[10,]   75   76   98
[11,]   80   90   98
 
Vladimir Perervenko:
Ниже пример получения (один из возможных!) того, что Вам нужно. Хотя и не понятно зачем Вам это? Или я не понял вопрос?

"999" is a support or resistance level, it doesn't really matter, just a "level".

the level is not on every candle, it happens when he wants, that's why the view

0 999   0   0   0 999   0   0 999   0

So when I create a train date and write each candle, I want to remember the last three levels that came before that.

That's kind of the whole point. :)

 

Some of the posts have been deleted...
I repeat to Andrey Dik, who bragged about his "codes":

Make this Challenge Plz -https://numer.ai/

R result, assembled from "cubes" (standard functions and libraries) = 0.69121https://numer.ai/ai/dr_tr
Not much, but above average,
and considering that any schoolboy can build such a model from dice and teach it by the instruction for half an hour, the result is worthy.

Everyone can brag and teach... This result will tell a lot more about the person.

 
Dr.Trader:

Some of the posts were deleted...
I repeat to Andrey Dik, who bragged about his "codes":

Make this Challenge Plz -https://numer.ai/

R result, assembled from "cubes" (standard functions and libraries) = 0.69121https://numer.ai/ai/dr_tr
Not much, but above average,
And considering that any schoolboy can build such a model from dice and teach it by the instruction for half an hour, the result is worthy.

Everyone can brag and teach... This result will tell you a lot more about the person.

Are you still going to keep "poking"?

What makes you think I'm going to fall for the "how dare you?" fool. What interest do I have in doing that?

I was not bragging about my codes, but stating a fact. The genetic algorithm of the article (but more its modifications) is actually used by thousands of people in their projects (completely free of charge). They contact me and ask to integrate it into their projects, if it does not work. This was a parry on the "you're a troll and didn't do shit" kind of lunge, rather than bragging.

 

I got information on Random Forests for Survival, Regression and Classification (RF-SRC) from the news feed. The package is called randomForestsSRC.

Random Forest for Survival - Survival.

I looked up what "Survival" is in general.

In our ideology, for example, "Survival" is a gain of 100 pips. In medicine, where such models are applied, it is death.

The model itself requires a "time to live" variable. As such variable the number of bars before reaching 100 pips in my example is suggested.

We build a teacher for the model.

ZZ gives reversals. The shoulders are marked with zero and one.

In the survival models we need the second variable - the time of survival.

In PZ we set the minimum profit in pips.

Then we go back and form the numbers of bars prior to this reversal. If it has unfolded later than its parameter, all bars that guarantee us profit are marked the same. This is the time to live. We obtain a vector of the following form:

1,1,1,..1,2,3,4... n

Bar number "n" corresponds to a ZZ reversal. And from 1 to n gives the profit, which we have set as the ZZ parameter.


PS.

There are a lot of Survival models. Personally I did not pay attention to them, because they are used in medicine. Although "died" and "cured" used in these models are very well interpreted in trading as take profit, stop loss, drawdown, i.e. some boundary conditions, on occurrence of which trading orders follow.


 
Dr.Trader:

Some of the posts have been deleted...
I repeat to Andrey Dik, who bragged about his "codes":

Make this Challenge Plz -https://numer.ai/

R result, assembled from "cubes" (standard functions and libraries) = 0.69121https://numer.ai/ai/dr_tr
Not much, but above average,
And considering that any schoolboy can build such a model from dice and teach it by the instruction for half an hour, the result is worthy.

Everyone can brag and teach... This result will tell a lot more about the person.

ML battle gotAI here guys have 0.69033 and they're ashamed of it
 
mytarmailS:

"999" is a support or resistance level, it doesn't really matter, just a "level".

the level is not on every candle, it happens when he wants, that's why the view

0 999   0   0   0 999   0   0 999   0

So when I create a train date and write each candle, I want to remember the last three levels that came before that.

That's kind of the whole point. :)

==================================

Ahh, well, this needs to be changed a bit. Use a sliding window of width 100.

 
lucky_teapot:
ML battle gotAI here guys have 0.69033 and they are ashamed of it

Interesting thread, thanks, especially comrade "NO"

Vladimir Perervenko:

Already redone it, thanks

 

Accidentally looked at lucky_teapot's profile, there was a thread on the forum with a link to the article in it. I think it was transferred from mql4.com forum, which I almost never studied, thanks to MetaQuotes if it was really from there.
This article is almost 9 years old, but I've found a lot of useful stuff, which is good to try now. I think I even understood about dimensional lag space, which in this thread Alexei mentioned a couple of times.
The article itself, I find very useful -https://www.mql5.com/ru/articles/1506

All the lectures of this course, also interesting -http://www.intuit.ru/studies/courses/2255/139/info

 
Dr.Trader:

I accidentally looked through lucky_teapot's profile, there was a forum thread with a link to an article. I think it was transferred from mql4.com forum, which I barely studied, thanks to MetaQuotes if it was really from there.
This article is almost 9 years old, but I've found a lot of useful information, which is worth trying now. I think I even understood about dimensional lag space, which in this thread Alexei mentioned a couple of times.
The article itself, I find very useful -https://www.mql5.com/ru/articles/1506

All the lectures in this course, also interesting -http://www.intuit.ru/studies/courses/2255/139/info

===========================================================================

At the time the article was read with great interest. Today it's a bit cutting to the ears - "game", "guessed". A lot of math, somehow academic, but this is the details of course. Since then the main thing for me is to use only indicators for inputs, not to use standard metrics, only classification and dynamic lot volume determination.

At that time there weren't many packages for neural networks (for example FANN), and to combine them with MT4 was an adventure. Now of course the choice of programs is much wider. You just have to master it.

Good luck