vsaveris / trading-technical-indicators

Trading Technical Indicators python library
https://www.trading-technical-indicators.org/
MIT License
114 stars 33 forks source link

Include max_investment argument in the runSimulation method of tti.indicators package #5

Closed vsaveris closed 3 years ago

vsaveris commented 3 years ago

Currently, in the runSimulation method of the tti.package, all the buy trading signals are processed, without any limitation on the investment.

This can bring some unrealistic scenarios, in case of a high number of consecutive buy signals. In that case the investment can become very high.

For this reason a new input argument should be introduced (max_investment). In case where max_investment already reached, new buy signals are being ignored, till some balance becomes available with a sell trading signal.

Simulation code, and returned simulation data should be updated accordingly. ignored_buy_signals entry should be included in the returned statistics.

Target release 0.1.b3

Tasks:

vsaveris commented 3 years ago

Description of the new argument:

max_investment(float, default=None): Maximum investment for all the opened positions (short and long). If the sum of all the opened positions reached the maximum investment, then it is not allowed to open a new position. A new position can be opened when some balance becomes available from a position close. If None, then there is no upper limit for the opened positions.

vsaveris commented 3 years ago

Development is done, ready for test cases development.