To all programming gurus out there,I'm facing a small problem with the for loops below, ok to describe briefly, the EA will before placing a pending buy order it will

1st chk for any current open BUY place if there is it will not set the pending buy

then if there's absolutely no open BUY place, it will continue to test for present BUYSTOP order, if there's a BUYSTOP order loed it will delete it and set a new BUYSTOP order.

I'd written the code below but it seems it fails to get into the 1st for loop. Can any1 give a hand. thanx a million !

Http://1.bp.blogspot.com/_NEedAj8WIe...0/s1600/EA.jpg

Inserted Code if (high2low gt; Buy1_2 candle_close lt; candle_open) pending_buy = var_high 0.0001; // store the high 1 pips int k=OrdersTotal(); Print(k=,k); if(k==0) Order = SIGNAL_BUY; else for(int j=0;jlt;k;j ) Print(INSIDE FOR LOOP1); OrderSelect( j, SELECT_BY_POS ); Print(Ordertype=,OrderType()); if(OrderType() !) = OP_BUY) for(int l=0;l==k;l ) Printing(INSIDE FOR LOOP2); OrderSelect( l, SELECT_BY_POS ); if(OrderType() == OP_BUYSTOP) OrderDelete( OrderTicket(), DarkGoldenrod ); Order = SIGNAL_BUY; else Order = SIGNAL_BUY;