If a strategy uses a long and short criteria and a breakeven- or trailing stop there’s a problem. The case is that they both need a scenario where there’s no market position, and that “not on market” is used to enter a new position. If there’s no market position, the breakeven and trailing stop are correctly calculated when a position is entered. If there’s i.e. a long position and there’s short signal, the position should go the opposite. Problem is that the breakevenstop and trailingstop are not correctly calculated for the short position, there was never a “not on market” moment. As a result to have good strategy calculations, you need to enter “not on market” when the position enters the market, but then it ignores the short (opposite) signal and stays long. Not an obvious flaw, but one which can impact a strategy in a good or bad way. So my goal is: use correct values for breakeven and trailing stop, regardless if the position goes the opposite direction, so replace the “not on market” check for the breakeven- and trailingstop with something else. That “not on market” is not used as criteria to enter a new position, since it skips an valid opposite signal Any solutions? // mfe trailing stop if mfewtrailingstop then trailingstop = (tradeprice/100)*mwts if not onmarket then maxprice = 0 minprice = close priceexit = 0 endif if longonmarket then maxprice = max(maxprice,close) if maxprice-tradeprice(1)>=trailingstop*pipsize then priceexit = maxprice-trailingstop*pipsize endif endif if shortonmarket then minprice = min(minprice,close) if tradeprice(1)-minprice>=trailingstop*pipsize then priceexit = minprice+trailingstop*pipsize endif endif endif if breakevenstop then if not onmarket then newsl=0 endif if longonmarket and close-tradeprice(1)>=((tradeprice/100)*besg)*pipsize then newsl = tradeprice(1)+((tradeprice/100)*besl)*pipsize endif if shortonmarket and tradeprice(1)-close>=((tradeprice/100)*besg)*pipsize then newsl = tradeprice(1)-((tradeprice/100)*besl)*pipsize endif if newsl>0 then sell at newsl stop exitshort at newsl stop endif endif if tradetime and not onmarket then if pclong and mclong and eclong and iclong and trendup then buy positionsize contract at market longtradecounter=longtradecounter + 1 tradecounter=tradecounter+1 endif if pcshort and mcshort and ecshort and icshort and trenddown then sellshort positionsize contract at market shorttradecounter=shorttradecounter + 1 tradecounter=tradecounter+1 endif endif