What can I do to make a percentage based mgmt work with an ATR based stop distance? The code is not working when I change the StopLoss value from a fixed value to an ATR based distance. Capital = 100000 Risk = 0.01 StopLoss = (atr * slATRmultiple)*pointsize equity = Capital + StrategyProfit maxrisk = round(equity*Risk) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pointsize)