[PYTHON] I tried FX technical analysis by AI "scikit-learn"

table of contents

    1. at first
  1. Document structure
    1. Document contents (excerpt)
  2. Impressive process
  3. Where to get "PDF version document and data for execution"

1. 1. at first

This is a water strider. (Of course, pen name) Actually, the author has been continuing the EA development of MT4 (MQL4) for a long time, hoping to connect it to actual profit if it can be done as a hobby, and for the past 1-2 years, especially linking MT4 and AI (especially non-technical analysis) ) Was the main focus, but the results were not so good and I was stuck.

So, although it is not a short break, I tried to apply AI to "technical analysis" that I thought that the functions and performance of MT4 were sufficient, "AI" scikit-learn " FX technical analysis by ".

Since I am a beginner in AI, I have researched many articles and materials that try to utilize AI for FX technical analysis. (Net and books) However, unfortunately, I couldn't find anything that could be used properly. Maybe some private business ones can be used, but they aren't available to the general public like me.

So, I tried my own method (probably) to use MT4 (MQL4) to select "features" to be used in AI. In fact, I found other tools (especially Python-based) that could be used. This is a measure I took because I didn't have it, but I think it's probably a difference in the development process from other developers.

Although it is currently a prototype version, we have obtained "results that will shine if polished", so we decided to release it to everyone. Documents (reports) are serialized and divided into two. (Currently there are two, but we plan to increase them in the future)

2. Document structure

This series reports the test results when AI (scikit-learn) is used for prediction by technical analysis of FX (USDJPY; dollar / yen). (Currently the prototype version)

** Attempt of FX technical analysis by AI "scikit-learn"; ** It is divided into [Part 1] and [Part 2].

◎ Please read [Part 1] first, and obtain [Part 2] if you think it is worth reading. (How to get it is described in [Part 1].)

3. 3. Document contents (excerpt)

** [Goal this time] ** ・ ・ Refer to the block diagram It is to extract the "technical analysis result" that is worth passing to the MT4 (MQL4) side on the AI side. To be honest, I think that MT4 (MQL4) is sufficient for the technical analysis function. When I tried it, I got quite interesting results, I think the try was not wasted. (AI program is written in Python) 19_01.png

** Explanation contents in [Part 1] and [Part 2]; ** First of all, the "procedure for applying AI to FX technical analysis" adopted by the author this time is as follows. 19_02.png

(1) [Part 1] is An example of the last stage ・ DataFrame (features and labels) generated from the Forex (FX) chart Explains an example of performing machine learning / prediction using a Python program.

(2) In [Part 2] I will explain from the very first stage to creating a DataFrame with an example -Detailed explanation of how to generate DataFrame (features and labels) used in [Part 1](separate article).

** <Indicator used (example)> ** ・ ・ [Part 2] posted 19_03.png The indicator used to extract the features is common as the author's original (pine needle type filter). Bollinger band.

** ** ・ ・ Posted in [Part 1] The example DataFrame has up to 1049 rows. -Column elements are features and labels, -Row elements are "data" extracted from the FX chart. 19_04.png

** ** ・ ・ [Part 1] posted, "2 examples" The figure below is an image cut from the description (Spyder output) Example 1; 19_05.png Example 2; 19_06.png

** [Win / Loss Judgment Method] **

4. Impressive process

The cause is that SVC (SVM) deals with "unbalanced data", that is, the number of data between classes is large. I learned that various advance adjustments are essential when dealing with objects that are highly biased. (Scaling, normalization, etc. need to be adjusted) After all, I changed the classification algorithm to "Random Forest" to solve this annoying problem. As a result of avoiding it, the result was quite convincing.

5. Where to get "PDF version document and data for execution"

** ◎ Where to get [Part 1] URL ** ** ① Document (PDF) **; http://mql4.s1002.xrea.com/ai_tec/ai_tec_01.pdf ** ② Data set (.zip) **; http://mql4.s1002.xrea.com/ai_tec/ai_tec_01.zip

** ◎ About MT4 (MQL4) and EA **

that's all

Recommended Posts

I tried FX technical analysis by AI "scikit-learn"
OpenCV AI Kit (OAK-D) I tried @ windows10
I tried multiple regression analysis with polynomial regression
I tried time series analysis! (AR model)
I tried fractal dimension analysis by the box count method in 3D
I tried shortening Python's FizzBuzz little by little
I tried handwriting recognition of runes with scikit-learn
I tried to program bubble sort by language
I tried cluster analysis of the weather map
Before the coronavirus, I first tried SARS analysis
I tried principal component analysis with Titanic data!
I tried to make AI for Smash Bros.
I tried using the Datetime module by Python
I tried morphological analysis and vectorization of words
I tried to classify dragon ball by adaline
I tried scraping
[First data science ⑤] I tried to help my friend find the first property by data analysis.
I tried PyQ
I tried AutoKeras
I tried papermill
I tried django-slack
I tried Django
I tried spleeter
I tried cgo
Draw a graph in Julia ... I tried a little analysis
I tried to predict the J-League match (data analysis)
[OpenCV / Python] I tried image analysis of cells with OpenCV
[TensorFlow] I tried to introduce AI to rolling stock iron
I tried increasing or decreasing the number by programming
AI Gaming I tried it for the first time
I tried to make Othello AI that I learned 7.2 million hands by deep learning with Chainer