kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.39k stars 1.05k forks source link

Operations sizeing #1019

Open BurningFighter opened 1 year ago

BurningFighter commented 1 year ago

Good evening, i have a problem with the calculation of the size in FOREX trading. I don't know what i have to do for give the correct values of size in the orders, can anyone help me? This is an example: My "cash" is €5000 and i would to risk 1% of my cash for every operation. My strategy predicts an R/R of 2.5, then:

self.sell(size=???, limit=1.0000, sl=1.0020, tp=0.9950)

If i'm not wrong the correct size is: 25'000, but if i change the size, the trade change.. This picture is an example of what i mean. 1° Operation: image

2° Operation: image

The only difference of that operations is the size.. i can't understand how it works.