Opps, I should made it 100 I was so focused on idea, didnt notice number.. Let me explain why "not orderstotal()-1" and simple a big number like 100. In your way, if you encounter (you probably encounter requoting or context busy) error, then you ...
with hold seconds — Here it is.. Added code is below: extern int Position_Min_Hold_Seconds=120; .... if(TimeCurrent()>OrderOpenTime()+Position_Min_Hold_Seconds) OrderClose... (I didnt test it. )