ラベル

AI Forecast 8306MUFG (211) Social (75) life (70) Financial (62) IT (57) Proposal (56) idea (50) Fund Management (48) Trading (43) economics (42) Covid-19 (40) AI (38) Hedge Fund (36) Risk (36) Culture (31) BOJ (29) Science (26) hobby (24) accounting (17) Apps (16) career (11) job (7) Travel (5) emotion (5) Hiking (4) music (3) Statarb (2) piano (2)

2020年1月29日水曜日

AI 株価予測ー新値3本(日次) Stock Price AI Forecast - Three Line Break (Daily)

AI 株価予測 ー 新値3本(日次)

Stock Price AI Forecast - Three Line Break (Daily)


新値3本(日次、月次はこちら)をAI予測するツールを作って見た。なぜ、新値3本か? Made AI tool to forecast three line break(Daily. Monthly is here). Why three line break?

注)この投稿はあくまで実験ベースです。計算結果に基づく実際の投資は一切行わないでください。
Caution) This article is for experiment only.  Never make any actual investment based on the result.

株価を予測するAIは多く発表されている。しかし、ARIMAモデルなど自己相関に基づくモデル、オシレーター系のテクニカルチャートを使ったモデルなど、いずれも時間軸に縛られたモデルが殆どで、位相の伸縮に対応できないのが難点だ。Lots of AI systems out there to forecast stock price. However, most of them are bound to time axis such as ARIMA model, based on auto-correlation or oscillator based technical chart models, hence they cannot cope with extension or shrinkage of phase.

一方、新値3本は時間軸を無視して値動きのみを捉えたテクニカルチャートだ。過去3回の新値が否定された場合方向が逆転する。上図はTSE東証 8306 MUFG (株)三菱UFJフィナンシャル・グループの新値3本チャートだ。ロウソク足チャートと比べ、かなりすっきり特徴だけが抽出されている。Meanwhile, three line break ignores time axis but focus only on price movement. Denial of last 3 line inverts the direction. Picture above shows three line break on TSE 8306 MUFG. Looks much simpler depicting characteristics, compared to original candle stick chart.

このAIでは、2001年から現在までの日次の株価をベースにニューラルネットを教育する。新値3本の過去N本分(初期値は20)の値幅から、つぎの新値の値幅を予測する。厳密な逆転は考慮せず、次の新値の方向性を見る。エポックの初期値は収束のため20としてあるが、学習時間はかなりかかるため、動作チェック時には3などに減らす。This AI trains neural net based on daily stock price movements from yr 2001. Forecast next line break from previous N(default is set as 20) three line breaks.  Strict reversion is not considered but looks for direction of next break. Initial epoch is set as 20 for convergence but set down to 3 or lower for function test only since it takes long time to run.

活性化関数は全部で11ある。There are all 11 activation functions you can try (elu, hardsigmoid, linear, relu, relu6, selu, sigmoid, softmax, softplus, softsign, tanh).

すべてJavascript(github here)であなたのマシン上で実行される。ハードウエアアクセラレーションをブラウザ設定でONにするとWebGLがデフォルトで起動するので、強力なGPUがあるマシンの方が有利だが、なくても十分動作する。All run on your machine by Javascript(github here). If you turn on hardware acceleration in browser setting, WebGL will run on default, hence powerful GPU has advantage however, even if you do not have, it runs pretty ok.



JS FileReader
TLB(Three Line Break) Neural Net Prediction on TSE東証 8306 MUFG (株)三菱UFJフィナンシャル・グループ
Normalized Version
#OfNeurons/layerニューロン数/層
#ofEpoc教育繰り返し回数
InputLyrActivFunc入力層活性化関数
HidnLyrActivFunc中間層活性化関数
#ofHiddenLayer中間層の数
#ofThreeLineBreaks入力 新値 本数
ValidationSplit 検証用データ割合
ObservationStartDate 時系列開始日
ObservationEndDate 時系列最終日

Input most recent three line break width
 TLB width last 20 新値幅 20 本前
 TLB width last 19 新値幅 19 本前
 TLB width last 18 新値幅 18 本前
 TLB width last 17 新値幅 17 本前
 TLB width last 16 新値幅16 本前
 TLB width last 15 新値幅 15 本前
 TLB width last 14 新値幅 14 本前
 TLB width last 13 新値幅 13 本前
 TLB width last 12 新値幅 12 本前
 TLB width last 11 新値幅 11 本前
 TLB width last 10 新値幅 10 本前
 TLB width last 9 新値幅 9 本前
 TLB width last 8 新値幅 8 本前
 TLB width last 7 新値幅 7 本前
 TLB width last 6 新値幅 6 本前
 TLB width last 5 新値幅 5 本前
 TLB width last 4 新値幅 4 本前
 TLB width last 3 新値幅 3 本前
 TLB width last 2 新値幅 2 本前
 TLB width last 1 新値幅 1 本前
Output forecast of next three line break width
 ThreeLineBreak Forecast 新値幅予測