Having trouble writing an EA in FIFO land... I am trying to close all open orders once a set PT is hit... say all orders average a total of 50 pips --> close trade...
I am getting FIFO violations in my journal. I have played with different things in my code... I can successfully scrape the OrderOpenTimes() and sort them Ascending, which is awesome. But I do not know how to use that data to then iterate through open orders and close them.
could it be as simply as changing the order in which I iterate through OrdersTotal();?
For example, my standard iteration through orders looks like this:
for(int i=OrdersTotal();i>=0;i--)
If I change to the below, will the orders be in chronological order?
for(int i = 0 ; i < OrdersTotal(); i++)
I am getting FIFO violations in my journal. I have played with different things in my code... I can successfully scrape the OrderOpenTimes() and sort them Ascending, which is awesome. But I do not know how to use that data to then iterate through open orders and close them.
could it be as simply as changing the order in which I iterate through OrdersTotal();?
For example, my standard iteration through orders looks like this:
for(int i=OrdersTotal();i>=0;i--)
If I change to the below, will the orders be in chronological order?
for(int i = 0 ; i < OrdersTotal(); i++)