I need to create this:
- Check how many orders exists - If none, there is nothing else to do, but let's say we have 10 orders, so we continue to step 2.
- Sort - We know we have 10 orders, and we know their parameters - open time, lot size, trading type and many more. We want to sort our orders by age.
- Close 5 trades - we sorted out trades by age, so starting from the oldest one we close the first 5 that we have one after another.