Hi ALL, I have tried and tried but can't get a code to work that will only close the OLDEST position... only ONE position until the condition is met again to close... I want to close the Oldest Order when my

if(AccountFreeMargin() <AccountMargin())

Then close only one, the oldest order....

Everything I try either closes ALL of my open orders starting with the oldest one closing first......or ends up hopelessly in an error loop.....
Any ideas??