
Explaining general goal of this course
Main idea is to predict future price change of 28 financial assets. But also to use several other modules of Decision Support System to perform Demo Trading Experiment
Disclaimer:
Refresher of Big Strategy, Decision Support System...
Types of algorithmic systems. In this course we will look into Model based as well as Hybrid system!
Comparison of proposed method of Pattern Recognition vs 'conventional' algorithmic trading that implies Optimization
Theory about how to get and transform data to train models, verify them and perform predictions
Work on going
Getting the code
How to Clone code for R package lazytrade:
- get link from GitHub.com
A. Using GitHub Desktop (see Course 1)
- use link in menu File [Clone, from URL]
B. Using R-Studio
- use link in R Studio [create new project from version control...]
In this video we are using R Studio to get the code from GitHub.
In this video we demonstrate how to create R Studio project inside existing folder!
GitHub desktop can act like a hub of all [Version Control] projects that you might have
but how to add the projects that were created using other applications?
Before you can use modified R package it is necessary to 'build' or 'compile' package:
use Description file to define a new version
run code: devtools::document() to create documentation for the package
menu Build -> More -> Clean and Rebuild
optional: menu Build -> More -> Build Source Package [this will build package archive that someone else could use to install this package]
Function helps to 'compress' code into one functional block. We show how to understand this code by looking into function source code stored in the folder 'lazytrade/R'
This lecture features that R package allows automated test and checks:
Write tests
Define examples
Use build menu to run tests + checks
Check Readme.rmd document within lazytrade package for examples and instructions
There are two goals of this section:
Make sure latest current data is kept updated
Deploy a mechanism to aggregate latest data and keep it for later step (modelling)
Explain use of DataWriter _ v 6.01 to write data to files
purpose: this data will be used for 2 purposes:
use latest data for predictions
bring data for aggregation
deploy robot Data Writer v 6.01 in H1 chart
UseBarsCollect2200
retrieve data timeframe 1 Hour
Pair Selection 'All 28 pairs'
check that the files are generated e.g. AI_RSIADX<SYMBOL>60.csv
Note: data will kept updated at every new bar (every hour)
In short, data writer robot is executing the function collectandwrite() that:
executed on the beginning of a new bar
function is executed for an array of symbols
we can specify our own symbols (e.g. Futures, Commodities, etc) using a comma separated string e.g. : "#DJ30_U20","#EUR50_U20","FRA40_U20","#GER30_U20","#JP225_U20","#UK100_U20","#US100_U20"
for every asset we have a combination of indicators on specific shifts (we use RSI and ADX)
we also save close price of the latest close bar as well as the price 34 bars ago (this is to be able to calculate price difference for predictions as well as for strategy test)
Modify user path and run this script line by line [code is in the repository R_selflearning/PROD1]
purpose: This script is needed to collect historical data separately for every asset. This data will be used to train deep learning regression model
execute code line by line using R package source code, find these elements:
function 'fail safe' elements
read data from csv file
calculate 'LABEL' column
'trim' data amount
write data into 'rds' format
deploy windows task scheduler:
run this task 3 times x week
recur task every 1 week
at 21:50
Building a new model
Testing the model
Rebuilding the model
Analyse logs from the model performance
in this lecture we will be using function to make model
see script: 10_ForceModelUpdateM60.R
purpose: create deep learning models for the first time
Part1: Define variables of the function
read purpose of these variables
select and define them into Global Environment
Part2: Study Examples
Best model using RMSE as performance
Best model using 'Objective Test'
Model with Fixed or Random Neural Network structure
Part3: Random Neural Network Structure
Reproducibility of Neural Network modeling is usually bad
We write model into sub-folders
Select best model from sub-folder...
How to create logs:
log date and time
log time it takes to build model
log amount of data
Deploy script: 06_TestBuildTestModelM60.R
purpose:
perform strategy test on latest data
rebuild model again
repeat...
measure the time it takes to build model
deep dive into the function aml_test_model - prepare
Creating variables to execute code within the function
Strategy test part
Recording logs from the strategy test
run script analyze_results1.R
purpose:
analyse logs of strategy tests on different order hold conditions
Example on how to find the value of the first quantile from the data column
goals of this section:
deploy script to generate predictions
understand how functions work
Deploy script 07_ScoreDataM60.R
purpose:
apply model on new data
write predicted price changes to the files
:: Use this code in 'production'
"C:\Program Files\R\R-4.0.3\bin\Rscript.exe" "C:\Users\<... user path .. >\R_selflearning\_PROD1\07_ScoreDataM60.R"
Function documentation and reproducible examples directly in R:
execute in R console
?lazytrade::aml_score_data
Key concepts of the Decision Support System Robot:
Works from files (Entries, Filters)
Contains ‘filter’ logic to enter
Only executes trades, manages Stop Loss, Take Profit, etc
Logging of data (results, store/recover data)
Introducing more robust robot with corrected and tested behaviour
How does it work - functional description using a block diagram
Deploy the self-adapting trading robot by configuring terminal settings, using automatically assigned magic numbers, and saving profiles to restart terminals with new parameters.
To test this robot it is possible to:
use demo account;
use M1 timeframe
change content of files inside the terminal's sandbox
check out function GetTradeFlagCondition() for exact entry conditions
files examples for EURUSD charts are attached
Main logic of this robot is stored inside the function
Explanation how to log information from MQL4 variables to the flat files
Visual understanding why robot Falcon F2 uses arrays to keep information about opened positions
Brief introduction of the trading robot FALCON A
Repository with the code of the Trading Robot FALCON_A
Trying to reverse-engineer the trading robot
Visual understanding of knn algorithm
Review how to practically implement kNN in the DSS [Decision Support System]
This lecture is to review how new trading strategy with kNN integrated algorithm was implemented inside of the FALCON trading robot template
Added another trading robot adapted to work with Decision Support System
A little summary of the course... hopefully it was fun and interesting!
"No one can promise that this will work, at least it will work by itself!"
About the Lazy Trading Courses:
This series of courses is designed to to combine fascinating experience of Algorithmic Trading and at the same time to learn Computer and Data Science! Particular focus is made on building Decision Support System that can help to automate a lot of boring processes related to Trading and also learn Data Science. Several algorithms will be built by performing basic data cycle 'data input-data manipulation - analysis -output'. Provided examples throughout all 7 courses will show how to build very comprehensive system capable to automatically evolve without much manual input.
About this Course: Developing Self Learning Trading Robot with Statistical Modeling
This course will cover usage of Deep Learning Regression Model to predict future prices of financial asset. This course will blend everything that was previously explained to use:
Use MQL4 DataWriter robot to gather financial asset data
Use R Statistical Software to aggregate data to be ready for modeling
Use H2O Machine Learning Platform to train Deep Learning Regression Models
Use random neural network structures
Functions with test and examples in R package
Back-test trading strategy using Model prediction and historical data
... update model if needed
Use Model and New Data to generate predictions
Use Model output in MQL4 Trading Robot
Adding and using Market Type info [from course 6]
Experiment by adding Reinforcement Learning to select best possible Market Type
Try easy to deploy ready to use complex Trading System
"What is that ONE thing very special about this course?"
-- Watch AI predicting the future!
This project is containing several courses focused to help managing Automated Trading Systems:
Set up your Home Trading Environment
Set up your Trading Strategy Robot
Set up your automated Trading Journal
Statistical Automated Trading Control
Reading News and Sentiment Analysis
Using Artificial Intelligence to detect market status
Building an AI trading system
IMPORTANT: all courses will have a 'quick to deploy' sections as well as sections containing theoretical explanations.
What will you learn apart of trading:
While completing these courses you will learn much more rather than just trading by using provided examples:
Learn and practice to use Decision Support System
Be organized and systematic using Version Control and Automated Statistical Analysis
Learn using R to read, manipulate data and perform Machine Learning including Deep Learning
Learn and practice Data Visualization
Learn sentiment analysis and web scrapping
Learn Shiny to deploy any data project in hours
Get productivity hacks
Learn to automate your tasks and scheduling them
Get expandable examples of MQL4 and R code
What these courses are not:
These courses will not teach and explain specific programming concepts in details
These courses are not meant to teach basics of Data Science or Trading
There is no guarantee on bug free programming
Disclaimer:
Trading is a risk. This course must not be intended as a financial advice or service. Past results are not guaranteed for the future. Significant time investment may be required to reproduce proposed methods and concepts