After some thought, the fraction, f, to use on a trade shall be a function of 3 variables for stocks, and 4 variables for options:
f = g(cratio, histf(strategy), recentf(strategy)) --stock
f = g(cratio, histf(strategy), recentf(strategy), daystoexp) --options
The meaning of each variable is below:
cratio
This is the ratio of current account value at the time of the trade to the starting value of the thread (320K). The idea is to increase fraction used as the buffer increases, subject to not exceeding the optimal. So at the start of the thread, cratio was 1 for the first trade. At the moment it is about 0.94. The methods calls for extra-conservatism when the fraction is low.
histf(strategy)
This is the historical optimizing fraction for the strategy, which is recalculated after each trade using the strategy. (Example if a strategy has two trades: bought at 10, sold at 12 in the first trade, and then bought at 120, sold at 102 for the second trade, that is 20% gain followed by 15% loss in the underlying, the optimal fraction - what maximizes the total return compounded - is 0.83. This means total return is maximized by using 83% of account value per trade). There is an absolute maximum of 3.0 for stocks and 0.80 for options (arbitrarily chosen). If optimal fraction is negative, a value of 0 will be used. Adjustments will be made where there are not enough historical data (10 is my minimum) for a credible fraction. Fortunately almost all my strategies have enough historical trades to pass that test. The higher this value, the higher the value of f and vice versa.
recentf(strategy)
This is the recent optimizing fraction for the strategy, also recalculated after each trade based on the strategy. This only takes into account recent trades (I am leaning on using only the three most recent trades). If the most recent trade reveal a 0 optimal (negative or zero edge), the value of f will go down. Conversely the higher the value. The absolute maximum imposed by the prior paragraph applies here too.
daystoexp
For options the days to expiration determines what fraction that can be used. The closer to expiration of the option, the faster the percentage moves on the option premium, consequently the smaller shall be the value of f.
Next I shall look at my results for last year,and try to figure out a good formula for the function g as a combination of the above variables.