vsaveris/trading-technical-indicators

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

vsaveris opened this issue · 2 comments

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:

  • Update runSimulation method in the _technical_indicator.py module (tti.indicators package), as described above
  • Include additional tests for the runSimulation method in the test_indicators_common.py

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.

Development is done, ready for test cases development.