I’m new to this and I’m having trouble to make this money management code for my system to work the way I want it to.
I found a nice code with fixed fraction that member Despair hade posted some time ago:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
oncemultiplier=1
oncefraction=1000
oncenewlevel=1000
onceoldlevel=1000
oncestartpositionsize=1
oncepositionsize=startpositionsize
ifstrategyprofit>newlevelthen
multiplier=multiplier+1
oldlevel=newlevel
newlevel=strategyprofit+multiplier*fraction
positionsize=multiplier*startpositionsize
elsifstrategyprofit<oldlevelandmultiplier>=2then
newlevel=strategyprofit
oldlevel=strategyprofit-multiplier*fraction
multiplier=multiplier-1
positionsize=multiplier*startpositionsize
endif
The code works exactly the way i want it to, however I want the system to start at 3 contracts instead of 1. But when I try to raise my startPositionSize to 3.. every time I make profits/losses it increases/decreases the next positionsize by 3 instead of 1.
e.g. 3, 6, 9, 12, 9 , 12, 15 etc.
I want it to start with 3 contracts and then increase/decrease positionsize by only 1 contract steps at the time based on profits/losses.
e.g. 3, 4, 5, 6, 5, 4,
If someone can help me with this I would be very grateful!
However, the first time when it’s suppose to increase the contractssize from 3 to 4, it starts over from 2 contracts and then works it’s way up from that point one step at the time.
E.g. I start my backtest with 3 contracts as the startingpoint, everything works fine. But then when I have reached my first strategyprofit step (profit), it goes down to 2 contracts, when I actually would like it to go up to 4 contracts.
Do you know how to solve this last piece of the puzzle? 🙂
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.