
After this lecture you know what the course builds, what it deliberately leaves out, and how every lesson is put together.
The course kit. Download Kit.zip from lesson 0.3. Each module has its own script: p1_ticks.py for Module 1, p2_bars.py for Module 2, and so on up to p9_day.py. It is run in the practice lesson at the end of the module (1.6, 2.6 … 9.6).
Start with lesson 0.3: install the libraries and run check_setup.py. Every line must end with "ok". README.txt lists every file with its lesson.
After this lecture you see every step of the pipeline with its size and its time, and know which module builds which step.
Practice assignment. After this lecture you have one working environment for the course, know which Python runs the code, and have passed the kit check.
Kit files: check_setup.py, eurusd_week.parquet.
After this lecture you name, version and cache every output so that no result can be silently replaced.
After this lecture you hand the typing to an AI agent and keep the judgement, with a written task, an acceptance test and a short list of things to check by hand.
After this lecture you export ticks from the terminal, know what a tick row contains and which clock it is written in.
Kit files: ExportTicks.mq5.
After this lecture you read a multi-gigabyte tick file with bounded memory and parse its dates fast and correctly.
How not to do it. After this lecture you store ticks in parquet and never parse the same text file twice.
After this lecture you run four checks on every tick file and know what each finding means for research.
How not to do it. After this lecture you check whether a second data source is really independent before counting it as confirmation.
Practice assignment. After this lecture you run the four hygiene checks on a real week of ticks and store it in parquet.
Kit files: p1_ticks.py, kit_common.py.
A twenty-second request before Module 2: if the course has been useful so far, an honest rating helps other traders find it.
After this lecture you build one-minute bars from ticks three ways and check them against each other and against the calendar.
How not to do it. After this lecture you join bars and higher timeframes to ticks without handing any tick a single second of the future.
After this lecture you build M15 and H1 bars from M1 and join them to ticks at the moment they close.
After this lecture you define every indicator by its input, its smoothing and its start, and implement it the same way in research and in the robot.
After this lecture you know when a bar in time is the wrong unit, and how a threshold on ticks behaves on different instruments.
Practice assignment. After this lecture you build bars and an average from a week of ticks, join them both ways, and prove with a test which join is honest.
Kit files: p2_bars.py, kit_common.py.
How not to do it. After this lecture you recognise code that must not run as a Python loop and know what numba changes.
After this lecture you replace the common loops of a trading pipeline with a handful of numpy calls.
After this lecture you write a numba state machine that compiles, caches and gives the same answer as the plain Python version.
How not to do it. After this lecture you keep a year of ticks in memory comfortably and join bars to rows without copying the tick table.
After this lecture you parallelise independent work across processes and know how much to expect from it.
Practice assignment. After this lecture you time a plain Python loop against its numba twin, check that they agree, and replace a loop with searchsorted.
Kit files: p3_speed.py, kit_common.py.
After this lecture you write an event detector that gives one signal per episode and can run on a live stream.
After this lecture you choose a label that answers the question the robot will actually ask, with costs, and keep it out of the features.
After this lecture you measure the worst point of every position over its real life and know what it can and cannot be used for.
After this lecture you recognise overlapping labels in a dataset and know which tests they break.
How not to do it. After this lecture you split market data into halves by time, not by row, and check any "stable" effect with one row per event.
Practice assignment. After this lecture you build signals, exits, labels with costs and the worst point from raw ticks, and read the dataset critically.
Kit files: p4_dataset.py, kit_common.py.
After this lecture you check every feature against the moment each of its inputs becomes known, and against what the robot will have.
After this lecture you design features family by family, each answering one question about the market at the entry.
After this lecture you choose the units of a feature so that it means the same thing in a calm month and in a wild one.
How not to do it. After this lecture you check a new feature against the existing ones before adding it.
How not to do it. After this lecture you stop adding features when the gain disappears into the noise, and clean the set deliberately.
How not to do it. After this lecture you define every feature by what the robot will have at the moment of the decision, and measure the cost when it does not.
After this lecture you read feature importance from unseen data and know what each ranking really measures.
Practice assignment. After this lecture you add two features to a dataset, write each both ways, and let one truncated-history test decide which versions may stay.
Kit files: p5_feature.py, kit_common.py.
After this lecture you choose the question a model answers before choosing the model.
After this lecture you know how the three tree ensembles differ and pick one by walk-forward, not by habit.
After this lecture you judge a probability model by how it orders cases, and know what AUC does not say.
After this lecture you search parameters on folds, confirm them on folds the search did not see, and cache the search honestly.
After this lecture you calibrate model scores on earlier months, check them on later ones, and save the threshold with the model.
Practice assignment. After this lecture you train three ensembles on the same folds, choose between them honestly, and calibrate the winner on earlier months.
Kit files: p6_models.py, kit_common.py.
After this lecture you recognise a shuffled split on market data, measure how much it inflates a score, and know where the inflation comes from.
After this lecture you build a walk-forward schedule and know what the choice of window changes.
After this lecture you measure whether labels cross the boundary between training and testing, and size the gap from the label length.
How not to do it. After this lecture you move every data-driven selection inside the training months of each fold and measure the difference.
After this lecture you choose the training window on several test months and know how noisy one month is.
After this lecture you build the null distribution for a model score and put an interval on the real one.
After this lecture you measure how many discoveries a search produces by pure chance, and correct for them before believing any.
How not to do it. After this lecture you diagnose a weak test month by comparing its features with the training months before blaming the model.
Practice assignment. After this lecture you run the complete test of module seven on the dataset and report a score the way it should be reported.
Kit files: p7_walkforward.py, kit_common.py.
After this lecture you save a model as a bundle that carries everything the live system needs to use it correctly.
After this lecture you run one model server for several instruments and know each of its routes.
Kit files: ml_server_ema20.py.
After this lecture you send a real request by hand, read every error the server can return, and know where the milliseconds go.
After this lecture you decide in advance what the robot does when the model cannot answer, and make that decision visible in the log.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5.
Practice assignment. After this lecture you start the model server of the course from the kit and check every answer it can give.
Kit files: p8_server.py, kit_server.py, ml_server_ema20.py.
After this lecture you read the path of one tick through the expert advisor and know where each part of the research lives in it.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5.
After this lecture you keep every history a feature needs available to the robot, across restarts and from the first tick.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5.
How not to do it. After this lecture you log every feature the robot computes, compare it with research, and know the typical drifts and their size.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5.
How not to do it. After this lecture you make every path through the robot end in a log line, so that no signal can disappear unseen.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5.
After this lecture you install the server and the robot on a machine and avoid the four traps of a first deployment.
Kit files: EURUSD_EMA20_MeanRev_EA_v1.mq5, ml_server_ema20.py.
Practice assignment. After this lecture you replay a day of signals through the server and read the result the way the robot's log will be read.
Kit files: p9_day.py, kit_server.py.
This course contains the use of artificial intelligence.
This course takes you from raw forex tick data to a working AI trading bot. Not a toy: an MT5 expert advisor written in MQL5 that, at the moment of a signal, sends 29 numbers to a Python server and gets back a probability from a machine learning model. Everything between those two ends is the course: Python algorithmic trading, machine learning for trading, backtesting and the MetaTrader 5 robot itself.
The material is a real pipeline on real data: one year of EUR/USD ticks, 39 million of them inside trading hours. You load them in seconds, build bars that do not know the future, write fast Python with numpy and numba, turn a signal into a dataset with an honest label, engineer features, train tree models, test them in time, and put the model to work behind a server that the robot calls live.
Why engineering, and not a strategy. Sometimes the market simply offers no edge. But very often a model fails in live trading for an engineering reason: a bar joined at the wrong moment, a feature computed one way in research and another way in the robot, a test that let the future in through a selection. None of these show up in the final number, so most lessons come in pairs: how not to do it and how to do it, on the same data, with the cost of the mistake measured.
Here is what those costs look like. The model of this course scores 0.646 under the shuffled cross-validation every library offers, and 0.594 when it is tested the way a live robot lives, on the next month. A filter chosen on the whole year shows an effect thirty times its honest size. A feature built from results not yet known scores 0.815 in research and 0.556 live. Every one of these has a lesson, and every lesson has the check that catches it.
In this course you will:
Load a year of tick data in seconds: chunked CSV reading, types, dates and parquet
Clean ticks: repeats, spread ceilings, time order and gaps, on one written-down clock
Build bars and higher timeframes that never use a bar before it has closed
Write fast Python with numpy vectorisation and numba state machines, and measure it
Turn a signal into a dataset with an honest label: the outcome under your own exit
Engineer features that use only the past, and test each one for look-ahead
Train and compare Random Forest, ExtraTrees and LightGBM on market data
Test models in time: walk-forward with a gap, permutation nulls and bootstrap intervals
Serve the model from a Flask server: 29 numbers in, one probability out
Connect a MetaTrader 5 (MQL5) expert advisor to the server and reconcile it with research
Who this course is for. Python developers and algorithmic traders who want to build a forex trading bot with machine learning, end to end. MetaTrader 5 users who want to connect an MQL5 expert advisor to a Python model. Quant traders and data scientists who want an honest backtest and walk-forward test of a machine learning trading model before it trades.
What this course is not. It is not a strategy, and it makes no claim about profit. The running example, a signal that bets on price returning to its moving average, is here as material, not as a recommendation. You will not see a single profit figure on screen: you will see seconds, megabytes, rows, and the scores that tell you whether a model has learned anything at all.
What is included:
66 video lectures, 4 h 40 min: 44 lectures, 13 "how not to" lessons with the cost of the mistake measured, 9 practice assignments
A 10 min walkthrough of all 9 practice assignments in one video
A downloadable kit: 13 Python scripts (practice, setup check and the model server), the MetaTrader 5 expert advisor and tick exporter, a week of real EUR/USD ticks, the finished dataset of the year and the trained model
A one-page checklist from raw data to the expert advisor
Subtitles in 10 languages
How the course is made. The research, the data, the code and the lecture content are my own. The narration uses an AI clone of my voice, and AI tools helped with editing, translation of the subtitles and code review. Every script, number and slide was checked against the files it comes from.
Disclaimer. This course is educational. Nothing in it is financial or investment advice, a recommendation to buy or sell any instrument, or a promise of any result. Trading carries a substantial risk of loss.