- By reading this article, you’ll have a chance to save a minimum of 59$.
Previously on “How to design a machine learning trading bot”
We have started with “Collecting Data”:
We found out what is OHLCV data and, we learned why we need historical data and online data both together.
Then we continued with “Data Analysis”
We have seen how cleaning the data including features engineering is important. We learned that to make a stable machine learning model we need to prepare data in the right way and finally, we found out how visualizing data can help us to reach the goal.
Then we continued with finding a pattern:
We noted that you can be trapped like a horoscopist to find a pattern in data, and always follow the scientific ways and act as an astronomer. Then we had found a very simple pattern which was “SMA20” and we discussed how to label them to [0,1].
Now, it’s time to make a model. Like always I need to mention that at this season we design our product and in the next season we will develop it.
In regard, you should always design your pipeline on paper or even in your mind and then go for development. At least, I can say this is my way to follow the process and so far it works for me ;)
Step 4: Building a Model based on the determined pattern
Let start with the format of data in our hands at this moment.
We have OHLCV plus SMA20 and a column named target, like this:
So, at this step machine can help us to build a model, and the main question is how? Let’s review how machine learning classification techniques work:
First, the machine gets huge labeled data. (we already prepared it)
Then, by splitting the data to train and test, the machine is going to find a proper measure for the training set.
Finally, we do testing on the test dataset to find out if the model we built is fit or not?
I’ve just simplified the whole procedures, it’s a little bit more complicated than what I have told here
In many problems which they use machine learning to solve their problem that step is their final step and they reached their models, but in finance and trading problems, that level is not the end. We still need more jobs to do to find a fit model. We need to do “Backtesting” on the test dataset to review the result.
At this point, we need to define a strategy to buy and sell. In our sample (SMA20) our strategy to buy/sell could be very simple like this:
-The first time you see a label  open a long position (Buy)
- If you are in a Long position, close it, as soon as you see the label 
If you couldn’t follow what we talking about, check the following data. You can see the time we open the long position and the time we close it.
A trading model is a package of machine learning methods plus backtesting. Even, in some cases to have better performance, you can apply some rules to your prediction.
Also, from my point of view, a complete model contains a Long and Short Strategy together. In this case, you need to have more than one ML model.
As an example, an ML model for the Long position and an ML model for the Short position. At this place, your creativity helps you to build a comprehensive model.
What are we going to do now?
1DES is Trading solutions powered by Machine Learning. At 1DES, we offer an innovative way to trade with machine learning techniques.
There is a “Free Trial” plan for all users at 1Des.
Also, there are other plans if you want to trade more professionally, at this moment both of them have 50% off.
Additionally, as special offers for the readers of this article 1DES is going to refund the first-month subscription, if you select one of the Avion or Rocket plans before 20th March 2021.