The great and terrible MT4 forever (or how to strategise a transition) - page 30

 
in mt4 I can not compress the chart vertically levels of Fibonacci not see the graph is limited to 8000 pips))) how to solve it?
 

It's a strange thing to do on Forts. Here is the main part of position closing.

  if(Trade.PositionClose(mSymbol))
  {
     // --- Введем задержку пока не получим номер сделки, но не более 2-х секунд
    int cnt = 0;
    ulong deal = 0;
    while(((deal = Trade.ResultDeal()) == 0) && cnt < 20) {Sleep(100); ++cnt;}
    
    if(deal == 0)
    {
      ulong ttOrder = Trade.ResultOrder();
      if(HistoryOrderSelect(ttOrder))
      {
        ENUM_ORDER_STATE state = ENUM_ORDER_STATE(HistoryOrderGetInteger(ttOrder, ORDER_STATE));
        LOG("После закрытия позиции № сделки=0, Order=" + string(ttOrder) + " state=" + EnumToString(state));
      }
      return false;
    }
  }

Here is an excerpt from the Expert Advisor's log, i.e. it got to the section where the deal ticket is zero after 20 iterations of ResultDeal() checking:


JL    0    10:08:04.462    e-MultiPattern-0.15 (RTS-9.21,M5)    cStoploss::sortSL12 Дистанция контртренд=0 BID=172690.0, закроем Short
JM   0    10:08:06.695    e-MultiPattern-0.15 (RTS-9.21,M5)     ** 333-cMyTrade::ClosePosition. После закрытия позиции № сделки=0, Order=16868286 state=ORDER_STATE_FILLED

Here is an excerpt from the terminal log:

IG 0 10:08:04.465 Trades '733618': exchange buy 2 RTS-9.21 at market
KN 0 10:08:04.480 Trades '733618': accepted exchange buy 2 RTS-9.21 at market
OQ 0 10:08:04.481 Trades '733618': exchange buy 2 RTS-9.21 at market placed for execution

FG 0 10:08:04.517 Trades '733618': order #16868286 buy 2 / 2 RTS-9.21 at market done in 52.326 ms
JN 0 10:08:04.517 Trades '733618': deal #3413752 buy 2 RTS-9.21 at 172780 done (based on order #16868286)

Please advise who has a good understanding of MT5 trade logic. In the log of the terminal the order placing and deal creation has happened in one moment - 04.517 seconds.

But the EA in the while loop never saw a trade ticket and exited after 20 iterations at 06.695 seconds. Why does the structure have an order ticket but no deal ticket?

How is it guaranteed to get a trade ticket, especially if you use a partial close?

 
Vasiliy Pushkaryov to get a transaction ticket, especially if you use a partial close?

It can't be explained easily as there are a lot of pitfalls. Wrote a solution that allows users to work without any problems. But parsing the internal implementation is for special connoisseurs.

 
Make a proper tester for mt4 and in a couple of years mt5 will be forgotten
 
Dmitry Fedoseev #:

And in all seriousness...?

The "Humour" thread here

Bottom-up compatibility is one of the basic requirements for software. The code of a previous version must be adequately perceived by the subsequent one. Otherwise, the developer simply throws out the previous development and introduces a new one. The way to nowhere.

I absolutely agree that there is a need (first of all, for developers) to compile MQL4 code into MQL5 code.

 
Vladimir Baskakov #:
Make a proper tester for mt4 and in a couple of years mt5 will be forgotten by everyone

Baskakov, and the daughter uses MT5, the infamous...

 
I promised her an indicator six months ago, never did.
 
fxsaber #:

If ResultDeal is zero, it will still be zero after a million iterations in the loop, because it is an invariant parameter.

Because the placed market order is the result of OrderSend.

It's not quite clear. In MqlTradeResult structure help, it says

If the close returned an order ticket but there is no order ticket, is this TRADE_ACTION_PENDING type of transaction?

Or TRADE_ACTION_DEAL and the trade ticket may be "late" and not included in the structure?

I.e., it is better to search for a deal by order through the HistorySelect-functions?

 

And also, I'm sorry, it's a sore point. For developers: stop wasting insane and unjustified expenses on the maintenance of MT4, you already have half of your high-class professionals doing that.

Build the MQL4-MQL5 compiler once and concentrate on the important things. Achieve a stable first place in the final version among your competitors.

 
Vasiliy Pushkaryov #:

It's not quite clear. In the help for MqlTradeResult structure it is written

If closing returned an order ticket, but there is no trade ticket - is it TRADE_ACTION_PENDING type of operation?

Or TRADE_ACTION_DEAL and the trade ticket may be "late" and not included in the structure?

I.e., is it better to search for the deal by order through the HistorySelect-functions?

Although, the PositionClose(Symbol) method in SB assigns the transaction type TRADE_ACTION_DEAL.

It turns out that there should be a trade ticket, but it is often absent.