Thanks Jcl for your reply!!! And excuse me for my English. But I don't understood how the program place the pending orders higher than the Close. The cycle is this:
Code:
for(Price = 0; Price < Close+5*Grid; Price += Grid)


Suppose we are using EURUSD, with last price 1,32, so Close=1,32.
So at the biginning of the cycle,
Price=0
Then, after the first cycle:
Price=Price+Grid=0+200PIP=0+200*0,0001=0+0,02=0,02
Then, the next cycle:
Price=0,02+0,02=0,04
As you can see there will be a lot of cycles before arriving to 1,32+5*200
Instead I think that the solution could be this:
Code:
for(Price = Close; Price < Close+5*Grid; Price += Grid)


And than it it would take another cycle to place the pending orders lower the Close:
Code:
for(Price = Close; Price < Close-5*Grid; Price -= Grid)


I hope I explained.
Thanks again.