Pending Order Script Repair
what is your problem??? it work perfect to me.
Maybe you have problems with the software configuration.
In the terminal go to menu tools-options-experts advisors and there you have to activate the option "allow live tranding"..
I hope it works.
bye
try
if (OrderSend(Symbol(),OP_BUYSTOP,lot,uppergrid,3,0,0,"grid"+i,NULL,0,Lime) == -1) OrderSend(Symbol(),OP_BUYLIMIT,lot,uppergrid,3,0,0,"grid"+i,NULL,0,Lime) //same by sell if (OrderSend(Symbol(),OP_SELLSTOP,lot,lowergrid,3,0,0,"grid"+i,NULL,0,Red) == -1) OrderSend(Symbol(),OP_SELLLIMIT,lot,lowergrid,3,0,0,"grid"+i,NULL,0,Red);
didn't checked
what is your problem??? it work perfect to me.
Maybe you have problems with the software configuration.
In the terminal go to menu tools-options-experts advisors and there you have to activate the option "allow live tranding"..
I hope it works.
bye
is not an EA. is a script. The "allow live tranding".. option does not come up. Thank you.

- On ECN brokers you must orderSend with TP/SL==0, then orderModify
- Capture the return code from the orderSend and print it with GetLastError so you know WHY
Hello. Can someone please telll me what wrong with this script. It's suppose to open 5 pending orders... 5 above and 5 below current price. It never does. Thank you.
//+------------------------------------------------------------------+
//| Ty_PendingOrder.mq4 |
//| Copyright © 2010, tyfinity - mykautsar@gmail.com |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, tyfinity - mykautsar@gmail.com"
#property link ""
extern int gridspace = 50;
extern int gridnum = 5;
extern int lot = 1;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
double pgrid = Bid*MathPow(10,Digits);
double mgrid = MathMod(pgrid,gridspace);
double grid = pgrid-mgrid;
if (mgrid>=gridspace/2)
{
for (int i=1;i<=gridnum;i++) {
double midgrid = (grid+gridspace)/MathPow(10,Digits);
double uppergrid = midgrid+gridspace*i/MathPow(10,Digits);
double lowergrid = midgrid-gridspace*i/MathPow(10,Digits);
OrderSend(Symbol(),OP_BUYSTOP,lot,uppergrid,3,0,0,"grid"+i,NULL,0,Lime);
ObjectCreate("bhl"+i,OBJ_HLINE,0,0,uppergrid);ObjectSet("bhl"+i,OBJPROP_COLOR,Lime);
OrderSend(Symbol(),OP_SELLSTOP,lot,lowergrid,3,0,0,"grid"+i,NULL,0,Red);
ObjectCreate("shl"+i,OBJ_HLINE,0,0,lowergrid);ObjectSet("shl"+i,OBJPROP_COLOR,Red);
}
}
else
{
for ( i=1;i<=gridnum;i++) {
midgrid = grid/MathPow(10,Digits);
uppergrid = midgrid+gridspace*i/MathPow(10,Digits);
lowergrid = midgrid-gridspace*i/MathPow(10,Digits);
OrderSend(Symbol(),OP_BUYSTOP,lot,uppergrid,3,0,0,"grid"+i,NULL,0,Lime);
ObjectCreate("bhl"+i,OBJ_HLINE,0,0,uppergrid);ObjectSet("bhl"+i,OBJPROP_COLOR,Lime);
OrderSend(Symbol(),OP_SELLSTOP,lot,lowergrid,3,0,0,"grid"+i,NULL,0,Red);
ObjectCreate("shl"+i,OBJ_HLINE,0,0,lowergrid);ObjectSet("shl"+i,OBJPROP_COLOR,Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+