My first order, need help - page 2

 

qjol, gordon, the EURGBP order was on a EURUSD chart.

In my demo account the script is ok and it places orders on several currencies, even 16 at the same time. It was very good for me to have all the trade informations on the same row because I keep them from an Excel spreadsheet. Tomorrow I will try your code qjol.

Grazie mille, thanks, ciao,

Scheggia97

 
Good morning qjol, I have tried your code in demo. I have changed "Symbol()" with "EURGBP" and the order was executed but there is not the tp. Forgive me but I am a beginner. Ciao, Scheggia97
 

if there is an error u should c it in Expert columm what error u get?

 

qjol, below my sample script and the messages


int start()
{
//----
double Lots = 0.1;
string Pair1 = "EURCAD";
string Pair2 = "EURCHF";
int SL = 0;
int TP = 500;
int Magic = 12345;


int ticket = OrderSend(Pair1, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket == -1)
{
Print("OrderSend() error - ", GetLastError());
}
if (ticket > -1)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool retrn = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
if (retrn == false)
{
Print("OrderModify() error - ", GetLastError());
}
}

int ticket2 = OrderSend(Pair2, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket2 == -1)
{
Print("OrderSend() error - ", GetLastError());
}
if (ticket2 > -1)
{
OrderSelect(ticket2, SELECT_BY_TICKET);
bool retrn2 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
if (retrn2 == false)
{
Print("OrderModify() error - ", GetLastError());
}
}

//----
return(0);

}



2010.11.02 10:51:28 Script Market 00 EURUSD,H1: removed
2010.11.02 10:51:28 '1228030': order was opened : #772232 buy 0.10 EURCHF at 1.37745 sl: 0.00000 tp: 0.00000
2010.11.02 10:51:28 '1228030': request in process
2010.11.02 10:51:28 '1228030': request was accepted by server
2010.11.02 10:51:28 '1228030': order buy market 0.10 EURCHF sl: 0.00000 tp: 0.00000
2010.11.02 10:51:28 '1228030': order was opened : #772230 buy 0.10 EURCAD at 1.41325 sl: 0.00000 tp: 0.00000
2010.11.02 10:51:28 '1228030': request in process
2010.11.02 10:51:28 '1228030': request was accepted by server
2010.11.02 10:51:27 '1228030': order buy market 0.10 EURCAD sl: 0.00000 tp: 0.00000
2010.11.02 10:51:27 Script Market 00 EURUSD,H1: loaded successfully
 

int start()
{
//----
double Lots = 0.1;
string Pair1 = "EURCAD";
string Pair2 = "EURCHF";
int SL = 0;
int TP = 500;
int Magic = 12345;


int ticket = OrderSend(Pair1, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket > -1)
   {
   OrderSelect(ticket, SELECT_BY_TICKET);
   bool retrn = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
   if (retrn == false)
      {
      Print("OrderModify() error - ", GetLastError());
      }
else
   Print("OrderSend() error - ", GetLastError());
   }

int ticket2 = OrderSend(Pair2, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket2 > -1)
   {
   OrderSelect(ticket2, SELECT_BY_TICKET);
   bool retrn2 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
   if (retrn2 == false)
      {
      Print("OrderModify() error - ", GetLastError());
      }
else
   Print("OrderSend() error - ", GetLastError());
   }

//----
return(0);

}

 
qjol, thanks, next time I will use scr button.
I have tried the code, both on demo and on live, the orders were executed but the tp is still 0 ...
 

what error u get ?

 

Good morning qjol, it seems there is no error, the orders are good but no tp is setted, always 0


2010.11.03 06:47:58 Script Market 00 EURUSD,H1: removed
2010.11.03 06:47:58 '1228030': order was opened : #779036 buy 0.10 EURCHF at 1.37474 sl: 0.00000 tp: 0.00000
2010.11.03 06:47:58 '1228030': request in process
2010.11.03 06:47:58 '1228030': request was accepted by server
2010.11.03 06:47:58 '1228030': order buy market 0.10 EURCHF sl: 0.00000 tp: 0.00000
2010.11.03 06:47:58 '1228030': order was opened : #779035 buy 0.10 EURCAD at 1.41296 sl: 0.00000 tp: 0.00000
2010.11.03 06:47:58 '1228030': request in process
2010.11.03 06:47:58 '1228030': request was accepted by server
2010.11.03 06:47:58 '1228030': order buy market 0.10 EURCAD sl: 0.00000 tp: 0.00000
2010.11.03 06:47:57 Script Market 00 EURUSD,H1: loaded successfully
 

can't be, Because I wrote, if he doesn't succeeded to write why as u can c

   bool retrn2 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
   if (retrn2 == false)
      {
      Print("OrderModify() error - ", GetLastError());

If it is possible, send the entire code i will try to fix it, but

 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
{
//----
double Lots = 0.1;
string Pair1 = "EURCAD";
string Pair2 = "EURCHF";
int SL = 0;
int TP = 500;
int Magic = 12345;


int ticket = OrderSend(Pair1, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket > -1)
   {
   OrderSelect(ticket, SELECT_BY_TICKET);
   bool retrn = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
   if (retrn == false)
      {
      Print("OrderModify() error - ", GetLastError());
      }
else
   Print("OrderSend() error - ", GetLastError());
   }

int ticket2 = OrderSend(Pair2, OP_BUY, Lots, Ask, 3, 0, 0, "", Magic, 0, Blue);
if (ticket2 > -1)
   {
   OrderSelect(ticket2, SELECT_BY_TICKET);
   bool retrn2 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - SL*Point, Ask + TP*Point, 0, Blue);
   if (retrn2 == false)
      {
      Print("OrderModify() error - ", GetLastError());
      }
else
   Print("OrderSend() error - ", GetLastError());
   }

//----
return(0);

}

//+------------------------------------------------------------------+
Reason: