I use backtrader python framework to backtest ML classification algorithms to make decision to buy or to sell.

When I use RandomForest or other algorithms in scikit-learn packages it gives up to 55% of profit: PROFIT

The next run of absolutely the same code and data (just next run) gives 22% of loss: LOSS

Why is that? And what are the methods to avoid such a big range of results? Less, but more stable profit is better :)


closed as off-topic by LocalVolatility, chollida, Gordon, lehalle, Quantuple Feb 16 '17 at 13:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking assistance in developing a trading strategy are off-topic as they are unlikely to be useful to other readers." – LocalVolatility, chollida, Gordon, Quantuple
If this question can be reworded to fit the rules in the help center, please edit the question.


Set the random_state = 0 as a parameter in the model and retry this.

  • $\begingroup$ Yes, and then optimize the seed that works best for the range of markets. :D $\endgroup$ – K3---rnc Feb 16 '17 at 0:18

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