Thanks Guys, you did it again. Don't know what I would do without you.
I've attached a test file for you with appropriate commenting, sorry I didn't do it before.
But it comes down to these lines:

if(NumOpenTotal>0){
for(open_trades) {
...
...
}}

if(NumOpenTotal>0) {
//the following is the offending line that crashes the script. however it doesn't crash if open_trades is commented out. It also works the other way. If this line is commented out the open_trades line will not crash the script, but they don't appear to work together. shocked

if(TradeIsShort) {
...
...
}}

Thanks Again
P

Attached Files
atest2.zip (34 downloads)