Keep track of open trades !!

 

Hello,

I am trying to make a function to keep track of open trades so as to avoid place pending orders on the zone around those open trades, the zone can be defined by the spread and the stoplevel.

so if I have an open buy or sell, I don't want to place a pending order around these open trades, and i can have up to 20 buy and sell at a time .


any ideas or suggestions on how to approach this problem?


Thanks,

ICON

 
ICON:
I am trying to make a function to keep track of open trades
    for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber()  == magic.number             // my magic number
    &&  OrderSymbol()       == Symbol() ){              // and my pair.
        Print(OrderOpenPrice()); ...
Reason: