I would like to close a position partially (50%) when the loss runs under a certain threshold.

int reduce(){
for(open_trades) {
if(TradeIsOpen && !TradeIsPool && TradeProfit < 0 && abs(TradeProfit/TradeStopDiff) > 0.5) {
if(TradeIsShort)
exitShort(ThisTrade,0,abs(TradeLots/2));
else
exitLong(ThisTrade,0,abs(TradeLots/2));
}
}
}

Therefore, when the ratio of the loss/ original tradeStopDiff rises above 50% then close 50% of the position. This should happen of course only once.
It is partially working, but I need an additional statement to avoid a cycle which partially close the position several times.

My question: Is there in the TMF a variable where a I can see that the current position has been already reduced (partially closed)? Unfortunately, the TradeLots variable shows the actual (reduced) Lot size only. I could not find the init Lot size here.
Any trick?