Questions from Beginners MQL4 MT4 MetaTrader 4

 
If you have questions about MQL4, MT4, MetaTrader 4, please post in this thread. Especially when your questions are related to trading functions.
 
If possible, attach a topic so it doesn't get lost.
 
Vitalie Postolache:
If possible, attach the topic so it doesn't get lost.

The topic is attached. You can see it like this:

first click on the section name:

click on a section title

then you can see that the topic is at the very top:

topic attached

But: if there are more recent posts in other threads, the thread will of course go down.

 
Vladimir Karputov:

But: if there are more recent posts in other threads, the thread will of course go down.

Can't the forum engine allow a topic to be permanently at the top, among the pinned ones?

Because I've noticed that "pinned" topics slide down on the main page, they're only at the top when you go to the right section.
 
Vitalie Postolache:

Can't the forum engine allow you to pin a topic so that it's always at the top of the pinned ones?

Because I've noticed that "pinned" topics slide down on the main page, they're only at the top when you go to the right section.
Yes. It's the forum engine. You can only see an attached topic (even if it has slid to the basement) by clicking on the section name.
 

Forum on trading, automated trading systems and trading strategy testing

Questions from Beginners

Nickolay72, 2016.11.08 10:04

I need to know why take profit modification does not work, when i pre-specified SL and TP, DT gives out an error 130:

-Buy condition-

{
  Ticket=OrderSend(NULL,OP_BUY,Lot,Ask,slippage,0,0,NULL,magic,0,Blue);
  if(!Ticket>0)Print(GetLastError());
  else
  TP=NormalizeDouble(Bid+TakeProfit*Point,Digits);
  bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),TP,0,0);
   return;
}

-selling conditions-

{
  Ticket=OrderSend(NULL,OP_SELL,Lot,Bid,slippage,0,0,NULL,magic,0,Red);
  if(!Ticket>0)Print(GetLastError());
  else
  TP=NormalizeDouble(Ask-TakeProfit*Point,Digits);
  bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),TP,0,0);
   return;
}

What is wrong?


 

Forum on trading, automated trading systems and trading strategy testing

Questions from Beginners

Vladislav Andruschenko, 2016.11.08 10:35

bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),TP,0,0);

You haven't chosen a position to work with it:


OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES);

 

Forum on trading, automated trading systems and trading strategy testing

Questions from Beginners

Vitaly Muzichenko, 2016.11.08 12:26

What is this construction? Ticket is an integer (int): if(Ticket < 0) { ... }

 
Nickolay72

As an option:

  Ticket=OrderSend(NULL,OP_SELL,Lot,Bid,slippage,0,0,"",magic,0,Red);
  if(Ticket>0){
   TP=NormalizeDouble(Ask-TakeProfit*Point,Digits);
   if(OrderSelect(Ticket, SELECT_BY_TICKET)) {
     bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),TP,0,0);
   }
  return;
  } else {
   Print(GetLastError());
  }
 
Hello, can you please help with advice about a condition that the EA needs to work once a day, in general we need if (condition) {every day a pending order is placed at the same time} may be a simple solution that does not come to mind =/ an EA or script in whatever form
 
K_i_r_i_t_o:
Hello, can you please help me with advice about one condition that I need the EA to work once a day, in general I need if(the condition) {every day a pending order is placed at the same time} maybe there is a simple solution that does not come to mind =/ EA or script in any form

can take the value of 0 bar open time with period D1, + add the number of seconds,

in the condition to compare the current time with the obtained time in the first line

In a pending order you can set the number of seconds, the life time of the order.

Data_1=iTime(Symbol(),PERIOD_D1,0)+86400;  //время жизни ордера