OK. Great. Thank You.
I think I have it.
1. I can't have an open_trades loop without checking to be sure there is an open trade.
2. I have to use a global variable NumOpenTotal to check for open trades not a "trade variable" (TradeisOpen).
3. Pending trades don't have a TradePriceOpen, so I can only check that after checking the "TradeisOpen" trade variable.
4. I can't check any trade variables without doing so in either an open_trades loop or a separate "trade management function" (TMF).
so the correct sequence is:
if(NumOpenTotal>0)
for(open_trades)
if(TradeIsOpen)
perform some task
if TradeisLong
perform task #2
if TradeIsShort
performtask #3
endfor
endif
or maybe
if(NumOpenTotal>0)
performtmf();
then place the code including the open_trades loop in the performtmf function
Thanks again
P