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

 
Aleksey Terentev:
Network [64 GRU + 32 GRU + 2 Dense] in a classification problem using OHLC -> Buy/Sell model (7000 bar) on ~24 training run gives 0.9 - 0.8 accuracy. And all this in about 30 seconds.

What's in the signs and outs?
 
pantural:
What's in the signs and outs?

"OpenHighLowClose -> Buy/Sell"

update: buy/sell signal already posted in this thread.

 
elibrarius:
How are these results in trading? What is the deposit growth in % per month/year? If I train not for 7000 bars, but for 100000?

I am not dealing. I am busy with automation.

Also selection of neural network model is very sensitive. It is necessary to take into account the type of activation functions in layers, error function, training method and correct output pre-processing, as well as a lot of other nuances of the MO. All the training can reduce each signal very quickly to 0 in the [-1;1] range.

That's why I'm in no hurry to share the results.

 

Thank you. Just what I needed.

 

Who understands R? The first example with loading quotes throughquantmod, I can't draw the received quotes

getSymbols("AAPL", src = "google")
plot(AAPL[, "AAPL.Close"], main = "AAPL")

//
[1] "AAPL"
> plot(AAPL[, "AAPL.Close"], main = "AAPL")
Error in if (on == "years") { : missing value where TRUE/FALSE needed


https://www.r-bloggers.com/an-introduction-to-stock-market-data-analysis-with-r-part-1/

An Introduction to Stock Market Data Analysis with R (Part 1)
An Introduction to Stock Market Data Analysis with R (Part 1)
  • ntguardian
  • www.r-bloggers.com
Around September of 2016 I wrote two articles on using Python for accessing, visualizing, and evaluating trading strategies (see part 1 and part 2). These have been my most popular posts, up until I published my article on learning programming languages (featuring my dad’s story as a programmer), and has been translated into both Russian (which...
 
Maxim Dmitrievsky:

Who understands R? The first example with loading quotes throughquantmod has a hitch, I can't draw the resulting quotes

I executed the code from the article, everything worked the first time.
R version 3.4.2, but I don't think it matters much.

 

There is an idea that for training a classification model you need to balance number of classes, so that number of training examples with class "1" coincides with the number of training examples with class "2" (and remove unnecessary examples)

I noticed a similar requirement for some regression models, but it's more complicated - the number of examples with the target of 0.001 must match the number of training examples with the target of -0.001,
the number of examples with the target of 0.002 must match the number of examples with the target of -0.002, etc.

Here's a script to do this balancing -

#Подготовка  таблички для обучения модели, тут рандомные значения
#таргет  в колонке 11
trainTable <- cbind(matrix(runif(10000), nrow = 1000, ncol=10), 
                    round(sample(c(-runif(480)*runif(480), runif(520)*runif(520))*0.1), 3))#рандомные  значения для таргета, 3 знака после запятой.
                                                                                           #Позитивных значений на 40 больше чем негативных имитируя тренд в исходных ценах.


#Требуется  взять для обучения модели только такие строки таблицы когда число позитивных и негативных значений будет равно и отбалансировано по уровням

target <- trainTable[,11]
target <- round(target, 3) #округление  до определённой точности, тут 3 знака после запятой
targetFactor <- factor(target)
targetFactorLevels <- as.numeric(levels(targetFactor))
balancedIndexes <- c()
for(i in 1:length(targetFactorLevels)){
  idx <- which(target == targetFactorLevels[i])
  idxN <- which(target == -targetFactorLevels[i])
  minLength <- min(length(idx), length(idxN))
  balancedIndexes <- c(balancedIndexes, tail(idx, minLength), tail(idxN, minLength))
}
balancedIndexes <- sort(unique(balancedIndexes))

trainTableBalanced <- trainTable[balancedIndexes, ] #новая табличка на которой можно обучать модель
 

When are wavelets useful forecasters?

When the data show high volatility and gaps, which is typical in most high-frequency financial time series, forecasting becomes even more difficult. Using high-frequency exchange rate data, we show that wavelets that are robust to high volatility and gaps are useful predictors in high-frequency applications where high volatility is the dominant feature that affects valuation estimates, zone forecasts, or both. The results indicate that decomposing the time series into homogeneous components, which are then used in time series prediction models, is very important. Different components become more useful than others for different data associated with the volatility regime. We consider a wide range of linear and nonlinear time series models for predicting the high-frequency series of exchange rate increments. Our results indicate that when the data display non-standard features with high volatility, the nonlinear models outperform the linear alternatives. However, when the data are in low volatility ranges for both estimates and forecasts, simple linear autoregressive models prevail, even though considerable effort is required to remove noise in the data via wavelets.

 
Dr. Trader:

There is an idea that to train a classification model you need to balance the number of classes, so that the number of training examples with class "1" coincides with the number of training examples with class "2" (and remove unnecessary examples)

I noticed a similar requirement for some regression models, but it's more complicated - the number of examples with the target of 0.001 should be the same as the number of training examples with the target of -0.001,
the number of examples with the 0.002 target should be the same as the number of examples with the -0.002 target, etc.

Here is a script to make this balancing

What does it mean in essence?
If the dollar was growing (there was a trend) for some months, then by smoothing the amount of training examples we will show NS as if it was flat during all this time. And accordingly it will learn it to be flat. Is it correct? Maybe we should let it learn the trend?
Reason: