I am working on a college project wherein I want my machine learning model to predict the one-day-ahead direction of a given stock (i.e. whether the closing price of the stock would rise or fall as compared to previous day's closing price).

I am currently working on feature generation/extraction. In stock price direction prediction literature, the use technical indicators has been extensively studied. But I could not find much literature on the use of price action (candlestick patterns, to be specific) for prediction. So I want to implement candlestick patterns along with technical indicators to predict the direction. I generated some candle patterns from my data and assigned them scores.

The scores were assigned as follows:

If r denotes the no. of times the price moved in the direction indicated by the pattern and w denotes the no. of times the price moved in the opposite direction then, score = r/(r + w)

Now this is where I am confused and unsure about my approach. Some patterns obtained scores around 50% or less. Would these really help the model in predicting better? Or should I just drop the idea of using candlesticks and get on with technical indicators only?

Any advice or help is highly appreciated. Thank you.

P.S: I had asked this question on Cross Validated Stack Exchange and was advised to post the question here.

  • $\begingroup$ I can't advise on your ML approach, but if you're using ML.NET and need to produce technical indicators from quote histories, here's a .NET library that has a large universe of technical indicators: Stock.Indicators. Most of these also have manually calculated Excel spreadsheet examples in the affiliated GitHub repo if you want to see how they are calculated. $\endgroup$ Commented May 30, 2021 at 19:54

1 Answer 1


The accuracy of a model is only 1 factor in determining usefulness. Aside from the accuracy, it would help to determine how you would implement it in a simulated trading environment and look into the performance further.

Aside from a hit ratio or accuracy, you should compute other metrics such as:

  • The risk-reward ratio that your model realizes (not the theoretical one that you hope it will)
  • The profit factor: gross profit divided by gross loss
  • Average gain and average loss
  • Your expectancy per trade: (avg gain x hit ratio) - (avg loss x (1-hit ratio))
  • Breakeven ratio: 1 / (1 + avg win / avg lost)

There are other metrics, too, but they wind up having some redundancy. I'm sure you could find a ton if you do some searching or googling. The point is that a correct prediction 50% of the time could be profitable if it returns more than it risks. On the other hand, a model that hit's 80% of its trades but only returns 1 for every 10 it risks could be very unprofitable. You should make looking into other metrics a habit to be sure you aren't throwing away models that warrant further investigating or chasing models that aren't worth it.

  • $\begingroup$ thanks for the pointers. So the way I can check whether candlesticks would help me or not is by actually trying them out? Also what do you think about assigning the scores to the patterns? Is it a good idea? $\endgroup$ Commented Apr 6, 2021 at 1:56
  • $\begingroup$ Yes, try them out. IMO, adding a scoring feature would be down the road--at this stage you would just be adding complexity for no reason. I would opt to make each pattern it's own model at first and see which patterns are worth investigating and which aren't. $\endgroup$
    – amdopt
    Commented Apr 6, 2021 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.