Neural Networks Prediction Models For Trading In Python

Trying Neural Networks Model in Python for Algorithmic trading and price prediction. This video is linked to the previous one from …


  1. Hi, nice try! I have two remark to your neural network.
    1. Your data set is skewed. Your classes should have almost same count of samples. That's why your classifier predict only one class. You can delete some samples from bigger classes to equaling their sizes. Or you can use some of upsampling techniques.
    2.Also your network are overfitted. You can noticed that your train metrics and test metrics are very different. To solve this problem you can use less count of training epochs or add some dropout layers to NN. Also you can use some regularization methods.
    Good luck next time

  2. The best way to find the number and amount of nodes is to do it experementally with "Gridsearch" which tries out different combinations, or with hyperparameter optimization technique like Bayesian optimization, random search, or genetic algorithms. Your videos are very interesting, please make more videos about machine learning or deep learning predictions!

  3. Hello, your videos are very interesting but I do have a couple questions.
    1st …to your knowledge is this the common way the trading bots are working ? …you gather trading signals , probably you do some feature engineering and you train models to see what accuracy you get ?
    2nd do you share the .csv(s), it would be interesting to see what what manipulation could help the accuracy.
    Not a question …but it's quite strange that a model of 40% accuracy is enough, in my tests with sport betting I could reach around 60% but this was not enough, you need at least a steady 66.67% testing accuracy to have a profitable model (at least for the sports as I mentioned)

  4. ive been checking this book out. Machine Learning with Python for Everyone by addison wesley. dont know if will help . from what i gather in the preface it is a very hands on and practical book.

  5. The model found the easiest sweet spot, a local optimum by setting it's inner weights to optimize for the dominating feature. That's just the starting point. Now it's your work to help the model to find out of that local optimum. And that's not happening due to your bad choice to not normalize. See for example CNNs normalizing all rgb values also. Second your labels:they are not independant. It's not like a picture of a human, a bird, a fish. It's statistical data, so maybe like written before for example 0.1, 0.5 and 0.9. Or maybe from – 0.9 to +0.9, but wouldn't work with relu. Maybe you can optimize that already before to show different strengths of the signal and quantize it, not in clear categories?

  6. you have any fully working bots that trade with brokers? I'd like to just modify one with my own strategy. I have some template code working for Etrade so far.

  7. for direction forecasting dataset must be lagged such as forecasting one day direction for tomorrow – target 1/0 and features for today or more days early!

  8. Hi! Have you checked the Neuro Evolution of Augmenting Topologies? NEAT? I think the ES HyperNEAT, evolves the nodes, weights, connections on its own.

  9. Hmm updated and analyzed your code,, combined it with yahoofinance data, it seems, you compare two trading strategies, SMA and candlesticks logic,
    I dont think the later counts as a Target. The key idea behind trading is to find max profit, if all you want to do is candlesticks then do so, no need for neural net evaluation..
    Though interesting code, just might need some more fixing… and a better Target construct maybe in the form of profit or so.. just saying, need to study it a bit more.
    I never used skylearn, curious how it handles normalization, here.. i'm working on a tensor flow trader..

  10. report_train = classification_report(y_train, pred_train, zero_division=1)
    report_test = classification_report(y_test, pred_test, zero_division=1)

    To avoid some nasty warnings.

    Because I was not aware from where u got ur csv file I got mine from tradermade daily chart.

    My results are

    precision recall f1-score support

    0.0 1.00 0.00 0.00 5
    1.0 0.86 0.97 0.91 38
    2.0 0.57 0.57 0.57 7

    accuracy 0.82 50
    macro avg 0.81 0.52 0.50 50
    weighted avg 0.83 0.82 0.77 50

    precision recall f1-score support

    1.0 0.85 1.00 0.92 29
    2.0 1.00 0.00 0.00 5

    accuracy 0.85 34
    macro avg 0.93 0.50 0.46 34
    weighted avg 0.87 0.85 0.79 34

    **Train Results**
    Accuracy: 82.0000%
    **Test Results**
    Accuracy: 85.2941%

Leave a Reply

Your email address will not be published.