@globalarbtrader I am still contemplating ways of protecting my account from positions which start to move against me. The current system determines a position size based on (a) the value volatility versus the risk appetite and (b) the forecast, based on a combination of rules. The profit/loss of the open position is not directly included in any of these. Only indirectly: (a) if the loss increases the account value decreases (unless profits in other instruments offset this), thus the risk appetite becomes less as it is a percentage of the account size and (b) the forecast is (likely) going to change in the opposite direction of when the position was opened. I have the impression that these two indirect effects are rather slow and thus allow a position to rack up a substantial loss before being reduced/closed.
I programmed something similar; where VAR was inversely linked to drawdown (that is, as the system drew down, it backed out of the market). Cut a long story short, you make more money by taking risk and doing the uncomfortable thing.