How do I open a market order correctly? - page 9

 
fxsaber:
The OrderSend+Sleep(0) option is not slower than OrderSend+OnTradeTransaction. I've measured it. Therefore, I don't use the second variant not for asynchronous transactions.
I'm embarrassed to ask if"OrderSend+Sleep(0)" !
 
prostotrader:

The OrderSend+Sleep(0) variant is temporary, because it's a shortcoming of developers (don't use it as an example :) ).

When it's fixed, only OrderSend will be left

Is this your opinion or insider?
 
Dennis Kirichenko:
Is that your decision or an insider's view?
https://www.mql5.com/ru/forum/97557
Как правильно работать в MT5 с OrderSend
Как правильно работать в MT5 с OrderSend
  • www.mql5.com
Форум алго-трейдеров MQL5
 
Dennis Kirichenko:
I'm embarrassed to ask, does "OrderSend+Sleep(0)" !

Yes, there is no equality.

Forum on trading, automated trading systems and trading strategy testing

Libraries: MT4Orders

fxsaber, 2016.11.14 13:33

// 13.11.2016:
//   Add: Полная синхронизация OrderSend, OrderModify, OrderClose, OrderDelete с торговым окружением (реал-тайм и история) - как в MT4.
//        Максимальное время синхронизации можно задать через MT4ORDERS::OrderSend_MaxPause в мкс. Среднее время синхронизации в MT5 ~1 мс.
 
prostotrader:

The OrderSend+Sleep(0) variant is temporary, because it's a shortcoming of developers (don't bring it as an example :) ).

When corrected, only OrderSend will be left

Not corrected, because it's not a bug, but a feature.

Forum on Trading, Automated Trading Systems & Strategy Testing

How to work correctly in MT5 with OrderSend

fxsaber, 2016.11.15 13:30

Try writing the following function in your EA

  1. i = 0.
  2. Open a position on symbol[i].
  3. If i++ >= 5, we exit.
  4. If there is no slippage, we return to step 2. If there is slippage, we exit.

Forum on trading, automated trading systems and strategy testing

How to work correctly in MT5 with OrderSend

fxsaber, 2016.11.15 14:14

Someone implements it immediately

// MQL4&5-code

#property strict

#include <MT4Orders.mqh>    // https://www.mql5.com/ru/code/16006

void Func( const string &Symbols[] )
{
  const int Total = ArraySize(Symbols);
  
  for (int i = 0; i < Total; i++)
  {
    const double Price = SymbolInfoDouble(Symbols[i], SYMBOL_ASK);
    const int digits = (int)SymbolInfoInteger(Symbols[i], SYMBOL_DIGITS);
    
    if (!OrderSelect(OrderSend(Symbols[i], OP_BUY, 1, Price, 100, 0, 0, DoubleToString(Price, digits)), SELECT_BY_TICKET) ||
        (NormalizeDouble(Price - OrderOpenPrice(), digits) != 0)) // если не получилось открыть или есть проскальзывание - выходим
      break;
  }
}

void OnStart() // OnTick
{
  const string Symbols[] = {"EURUSD", "GBPUSD", "AUDUSD", "USDCAD", "USDJPY"};
  
  Func(Symbols);
}

And someone is waiting for mana from the developers.
 
Can you tell me how to set a stop and a take out?
 
avatar007911:
Can you tell me how to set a stop and a take?

here's a script to help you.https://www.mql5.com/ru/code/17994

Modify SL TP
Modify SL TP
  • www.mql5.com
Скрипт используется для изменения стоп-лосса и тейк-профита позиции.
Reason: