I am wanting to be able to run back tests / optimizations off of a $ amount and not a specific number of shares. Is this possible?
I am pretty sure I would need to declare a starting amount, calculate how many shares can be purchased with said amount, calculate profitability/loss once my position exits, add/sub my profit or loss from the starting amount, and then start the process all over. Has this been done before? Is there some example code out there which could help me with this?
I do not like the fixed number of shares approach because that does not allow you to factor in the compounding effect of your gains or losses (ex. if you invest 100k and lose 5k you can't repurchase 100k again. You need to determine your investment amount off of 95k at that point).
Any help would be appreciated.
Kenson
Comment