トレーディングにおける機械学習:理論、モデル、実践、アルゴトレーディング - ページ 1932

 
mytarmailS:

パッケージは不要です、どこに書いてあるんですか?

入力行列の非定形項目>>入力行列の非定形項目

おそらく、Infが あるのでしょう。

データで失敗したんだから、簡単な構文を工夫して、モデルを訓練してみたらどうだろう。

モデルを学習する前のデータに適用してみる

X <- as.matrix(X)
X[is.na(X)] <- 0
X[is.infinite(X)] <- 100

X は予測変数の行列である

マキシム・ドミトリエフスキー

5kmの眺望、アラビレッジ

あなたのカスタムビルドはどうですか?)

 
mytarmailS:

モデルを学習する前に、これをデータに適用してみる

X は予測変数の行列である

市井の人、何かいいことあった?)

くちやかましい

 
多項式や調和的近似について知っている人PLEASE!
 
mytarmailS:

パッケージは不要です、どこに書いてあるんですか?

入力行列の非定形項目>>入力行列の非定形項目

おそらく、Infが あるのでしょう。

データで失敗したのだから、簡単な構文で作業をしてみて、その後に初めてモデルを訓練すればいいのではないでしょうか。

終値の 列を与えてしまったのがいけなかったのでしょうか。

way <- "F:\\FX\\Открытие Брокер_Demo\\Musor\\000\\Save_OHLC.csv"  #  ваш путь

dt <- read.csv(file = way,header = T,sep = ";") #  читаем файл

clos <- dt$Close #  цеНу закрытия в отдельную переменную


get.ind <- function(x,n=5){
意味を理解するために、データを添付しますので、よろしくお願いします。
Документация по MQL5: Константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Технические индикаторы требуют для своих расчетов указания значений цен и/или значений объемов, на которых они будут считаться. Существуют 7 предопределенных идентификаторов перечисления ENUM_APPLIED_PRICE, для указания нужной ценовой базы расчетов. Если технический индикатор для своих расчетов использует ценовые данные, тип которых задается...
ファイル:
Save_OHLC.zip  5363 kb
 
Aleksey Vyazmikin:

私は何を間違えたのか、終値の 列を与えてしまいました。

私が与えたコマンドのうち、(( タイプを間違えてしまったようです。

 
mytarmailS:

私は何か間違ったことをしたに違いない(( 私が与えたコマンドを入力します。

Error in x2set(Xsub, n_neighbors, metric, nn_method = nn_sub, n_trees,  : 
  Non-finite entries in the input matrix

でも、もしかしたら置き場所を間違えたかな?

get.target <- function(x, change){
  zz <- TTR::ZigZag(x,change = change,percent = F)
  zz <- c(diff(zz),0) ; zz[zz>=0] <- 1 ; zz[zz<0] <- -1
  return(zz)
}

X <- as.matrix(X)
X[is.na(X)] <- 0
X[is.infinite(X)] <- 100

X <- get.ind(clos)
Y <- as.factor(get.target(clos,change = 0.001))


library(uwot)

0.001ってな んだ~?

 
Aleksey Vyazmikin:

でも、もしかしたら置き場所を間違えたかな?

場所が違う )))

作成前の「X」を操作したい場合

X <- get.ind(clos)
X <- as.matrix(X)
X[is.na(X)] <- 0

をこうしてください。


アレクセイ・ヴャジミキン

0.001って 何だろう--。

ZZの膝の大きさをポイント数で、または桁数に応じて指定します。


何が何だかわからなくなったら、見てください。

get.target <- function(x, change){
  zz <- TTR::ZigZag(x,change = change,percent = F)
  zz <- c(diff(zz),0) ; zz[zz>=0] <- 1 ; zz[zz<0] <- -1
  return(zz)
}

は、TTRパケットであることがわかる。

をコンソールに書き込む。

?TTR::ZigZag

てをかりる

igZag {TTR}     R Documentation
Zig Zag
Description
Zig Zag higlights trends by removing price changes smaller than change and interpolating lines between the extreme points.

Usage
ZigZag(HL, change = 10, percent = TRUE, retrace = FALSE,
  lastExtreme = TRUE)
Arguments
HL      
Object that is coercible to xts or matrix and contains either a High-Low price series, or a Close price series.

change  
Minimum price movement, either in dollars or percent (see percent).

percent 
Use percentage or dollar change?

retrace 
Is change a retracement of the previous move, or an absolute change from peak to trough?

lastExtreme     
If the extreme price is the same over multiple periods, should the extreme price be the first or last observation?

Details
The Zig Zag is non-predictive. The purpose of the Zig Zag is filter noise and make chart patterns clearer. It's more a visual tool than an indicator.

Value
A object of the same class as HL or a vector (if try.xts fails) containing the Zig Zag indicator.

Warning
The last value of the ZigZag indicator is unstable (i.e. unknown) until the turning point actually occurs. Therefore this indicator isn't well-suited for use for systematic trading strategies.

Note
If High-Low prices are given, the function calculates the max/min using the high/low prices. Otherwise the function calculates the max/min of the single series.

Author(s)
Joshua Ulrich

References
The following site(s) were used to code/document this indicator:
http://www.fmlabs.com/reference/default.htm?url=ZigZag.htm
https://www.linnsoft.com/techind/zig-zag-indicator-zig-zzo
https://www.linnsoft.com/techind/zig-zag-oscillator-indicator-zzo
http://www.metastock.com/Customer/Resources/TAAZ/#127
http://www.stockcharts.com/school/doku.php?id=chart_school:technical_indicators:zigzag
Examples

## Get Data and Indicator ##
data(ttrc)
zz <- ZigZag( ttrc[,c("High", "Low")], change=20 )
 
mytarmailS:

ない ))

作成前の「X」を操作したい場合

好い線行く


は、桁数に応じて、Xの膝の大きさをポイントなどで指定します。


何が何だかわからなくなったら、見てください。

を見ると、これはTTRパケットであることがわかります。

をコンソールに書き込む。

助けを求める

うん、もうちょっと進んで、こうなった。

> X <- as.matrix(X)

> X[is.na(X)] <- 0

> X[is.infinite(X)] <- 100

> library(uwot)

> train.idx <- 100:8000

> test.idx <- 8001:10000

> UM <- umap(X = X[train.idx,],
+            y = Y[train.idx], 
+            approx_pow = TRUE, 
+            n_components = 3, 
+            ret_mode .... [TRUNCATED] 

> predict.train <- umap_transform(X = X[train.idx,], 
+                                 model = UM, n_threads = 4 L, 
+                                 .... [TRUNCATED] 
11:08:52 Read 7901 rows and found 31 numeric columns
11:08:52 Applying training data column filtering/scaling
11:08:52 Processing block 1 of 1
11:08:52 Writing NN index file to temp file C:\Users\S_V_A\AppData\Local\Temp\RtmpK0sSR3\file28f467fe2995
11:08:52 Searching Annoy index using 4 threads, search_k = 1500
11:08:52 Commencing smooth kNN distance calibration using 4 threads
11:08:52 Initializing by weighted average of neighbor coordinates using 4 threads
11:08:52 Commencing optimization for 167 epochs, with 118515 positive edges
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
11:08:54 Finished

> predict.test <- umap_transform(X = X[test.idx,], 
+                                model = UM, n_threads = 4 L, 
+                                ver .... [TRUNCATED] 
11:08:54 Read 2000 rows and found 31 numeric columns
11:08:54 Applying training data column filtering/scaling
11:08:54 Processing block 1 of 1
11:08:54 Writing NN index file to temp file C:\Users\S_V_A\AppData\Local\Temp\RtmpK0sSR3\file28f45e3376d9
11:08:54 Searching Annoy index using 4 threads, search_k = 1500
11:08:55 Commencing smooth kNN distance calibration using 4 threads
11:08:55 Initializing by weighted average of neighbor coordinates using 4 threads
11:08:55 Commencing optimization for 167 epochs, with 30000 positive edges
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
11:08:55 Finished

> library(car)
Загрузка требуемого пакета: carData

> scatter3d(x = predict.train[,1], 
+           y = predict.train[,2], 
+           z = predict.train[,3],
+           groups = Y[train.idx],
+        .... [TRUNCATED] 
Загрузка требуемого пакета: rgl
Загрузка требуемого пакета: mgcv

価格ステップが1の場合、0,001を例えば100に変更すればいいのでしょうか?

100に変更しました。

11:15:15 Read 2000 rows and found 31 numeric columns
11:15:15 Applying training data column filtering/scaling
11:15:15 Processing block 1 of 1
11:15:15 Writing NN index file to temp file C:\Users\S_V_A\AppData\Local\Temp\RtmpK0sSR3\file28f417876e23
11:15:15 Searching Annoy index using 4 threads, search_k = 1500
11:15:15 Commencing smooth kNN distance calibration using 4 threads
11:15:15 Initializing by weighted average of neighbor coordinates using 4 threads
11:15:15 Commencing optimization for 167 epochs, with 30000 positive edges
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
11:15:16 Finished

> library(car)

> scatter3d(x = predict.train[,1], 
+           y = predict.train[,2], 
+           z = predict.train[,3],
+           groups = Y[train.idx],
+        .... [TRUNCATED] 
> 
 
Aleksey Vyazmikin:

そう、どんどん進んで、こんな感じになりました。

価格ステップが1の場合、0.001を例えば100に変更すればいいのでしょうか?


チェンジパラメーターで 遊ぶ

last200clos <- tail(clos,200)
plot(last200clos,t="l")
zz <- TTR::ZigZag(HL = last200clos , percent = F,change = 50)
lines(zz,col=2,lwd=2)
 
mytarmailS:


チェンジパラメーターで 遊ぶ

前回の結果、4つの明確なクラスターを得ることができました。

先ほど、結果を推定するための数値のお話がありましたが、どのような数値を見ればいいのでしょうか?

理由: