, 15 tweets, 4 min read Read on Twitter
#MachineLearning in System #trading. Here is a simple idea to improve your system.

#MachineLearning(#ML,#DeepLearning) is used in stock trading algorithms/system intraday or EOD based system. Mostly these systems are predictive systems.

These predictive system are based on given OHLC and other indicators (like RSI,MA,etc) tries to predict the value of next close/open/...using Machine learning/AI algorithms. There are many simple statistic based systems(call it non-AI system) also... (2/n)
Aim: to improve win ratio using #MachineLearning specifically classification algorithms
Input: your historical system trade data with various system parameters(like, rsi, supertrend , atr, etc) along with status or trade(winning or losing)
Core Idea- Since our aim is to improve win ratio- what we can do is identify patterns in the losing trades(if any). In future trade before placing order, we can pass input(rsi,supertrend,etc) at that time and system tells us that if that is going to winning/losing trade. (4/n)
Here is solution/algorithm/steps(can be implemented in python or R or any lang) :
1. Connect to your db or csv, loads the trade data e.g input features (columns-rsi,supertrend,atr or any other parameter you feel is making difference in decision) (5/n)
2. Divide the data into training(say 70%) and testing (%30) - multiple way but divide the data but i would suggest do it by time.
3. Use train data for training to Machine learning models
These are few machine learning classification algo- you can try
- SVM(with linear, polynomial,rbf)
- Logistic regression
- Decision tree/Random forest
- K-nearest Neighbor
- Naive Bayes
....baggin and boosting algos....and many more
4. In order to check which of the above algorithms/models are doing better- we can use the Precision, Recall, F-score. to simplify i would suggest use f-score of winning trade(class) to pick your algorithm(s)
5. The above measures helps you to pick right model for your data. You can check the measures using your train data itself after building models
6. Now use test data to see the performance of your models on unseen data.

If your test data numbers are in same range of training data numbers then it is better model/algorithm. - that's you are not doing over-fitting/under-fitting broadly speaking....
Pick and select model(s) from above exercise. Now comes real time use of this classifier:
1. get the input data in same format before putting trade/order
2. give this input data to above selected model
3. if output is winning then place order else don't
That's simple solution using AI/ML in trading. we need to test this properly so that type-I and type-II(false positive and negative) are minimized.
We are making many hidden assumption:
- Trade data has a pattern with respect to winning/losing trade
- Broadly, it is possible to separate winning trade and losing trade.
- Missing classification errors (type-i or type -2 ) are not significant
If above assumptions holds, you will be able to improve your win ratio and avoid losing trade
@alok_dharia @technovestor @SubhadipNandy @VohiCapital please RT if you find this helpful. (n/n)
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Vishal Vachhani
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($3.00/month or $30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!