Good morning, I have recently put Nicolas’s clever stop loss code : SET STOP LOSS abs(close – (lowest[3](low) * pipsize)) into my code and it works beautifully. My problem is that when in a trade, I want to limit the maximum $ loss of any single trade to $100 and I don’t immediately see how to do this whilst retaining the recent swing high/low stop loss code above. I checked the forum and found reference to the following post: https://www.prorealcode.com/blog/learning/max-profit-loss-day-trading-strategy/ BUT I can’t get it to work with the swing high/low code. It’s like the system just ignores my ‘max loss’ code resulting in many losses far in excess of $100 on the backtest. See below for what I currently have (without my buy/sell conditions which just add clutter). Any help much appreciated. Regards Mark MaxLoss=100 //Max loss allowed(in $) // first time we launch the code, the trading is allowed once TradeAllowed=1 // reset the current state of the strateygprofit each new day If intradaybarindex=0 then MyProfit=STRATEGYPROFIT TradeAllowed=1 endif // test if the strategyprofit of the day is currently above the daily profit allowed of below the daily loss allowed If StrategyProfit<=MyProfit-MaxLoss then TradeAllowed=0 endif // if max $loss of 100 on long/short trade then following code should be executed IF LongOnMarket AND TradeAllowed=0 then Sell PositionSize contracts at market endif If ShortOnMarket AND TradeAllowed=0 then Exitshort PositionSize contracts at market endif // BUY order code IF NOT OnMarket AND buyCondition and TradeAllowed THEN BUY PositionSize CONTRACTS AT MARKET SET STOP LOSS abs(close - (lowest[3](low) - 1 * pipsize)) set target $profit 150 ENDIF // SELL order code IF NOT OnMarket AND sellCondition and TradeAllowed THEN SELLSHORT PositionSize CONTRACTS AT MARKET SET STOP LOSS abs(close - (highest[3](high) + 1 * pipsize)) set target $profit 150 ENDIF