Features of the mql5 language, subtleties and tricks - page 44

 
After a successful OrderSend(Async), the Result.request_id field contains the number of requests sent to the trade server sincethe terminal was started(not the login).
 

I do not understand anything, for some reason class CCanvas normally draws lines on the canvas only when you zoom in the graph, and when you reduce it drawn only the canvas itself, and the lines are not drawn:

 
Konstantin:

I do not understand anything, for some reason class CCanvas normally draws lines on the canvas only when zoomed in the graph, and when you reduce it drawn only the canvas itself, and the lines are not drawn:


Don't post your code here, in case we will find the mistake.) A generation of clowns.

 

Found the problem, did not take into account when converting the coordinates of time / price in the pixel chart, referencing to the coordinates of the chart, should also lead to the coordinates of the canvas on which we draw ))


 

POSITION_TICKET may not be equal toPOSITION_IDENTIFIER only if there was a DEAL_ENTRY_INOUT(DEAL_ENTRY_OUT_BY)-trade.

If there was no such transaction, these position parameters will always match.

 
fxsaber:

POSITION_TICKET may not be equal toPOSITION_IDENTIFIER only if there was a DEAL_ENTRY_INOUT(DEAL_ENTRY_OUT_BY)-trade.

If there was no such deal, these position parameters will always match.

Not true. I encountered that when activating a pending order, the ticket and ID do not coincide, even in the account tester.

Therefore, to obtain a list of orders and trades belonging to a position, you should always use the ID, not the position's ticket.

 
Alexey Viktorov:

Wrong. I met that when you activate a pending order ticket and ID do not match, even in the tester of the account.

Code for the tester, please.

Therefore, we should always use the identifier, not the position ticker, to get the list of orders and transactions belonging to the position.

That was never the point. The point is something else:

  • If TICKET != IDENTIFIER, then 100% there was an INOUT-trade (the BY-case is not interesting, so I'm not writing it).
  • Otherwise, there was no INOUT transaction.
SZY As a consequence, in Hedge accounts POSITION_TICKET == POSITION_IDENTIFIER is always used, if CloseBy is not used.
 

How to determine the closing time of the previous day's market in the futures market in different variants of the current time interval:

1. we are in the interval Saturday - Sunday; we need close time of Friday evening trade session
2. in the interval of Monday-Friday closed market: we need the closing time of evening session Monday-Thursday
3. we are in the trading range Monday and we need to close time of evening trading session on Friday
4. in Tuesday - Friday trading interval and we need the closing time of the evening session Monday - Thursday

Maybe someone wrote a similar functionality, I do not want to reinvent the wheel ))

 
fxsaber:

Code for the tester, please.


Take any code with opening pending orders and drive to the brink, someday you will be lucky.

Key word in my post

There is no dependency and there cannot be one. Consequently, there can be no special code.
fxsaber:

  • If TICKET != IDENTIFIER, then 100% was INOUT-trade (BY-case is not interesting, so I don't write).

To be more exact, it is vice versa:

If there was an INOUT-transaction, then 100% TICKET != IDENTIFIER.

This is indisputable. Although on the otherge accounts an INOUT trade is born by counter-closing.

fxsaber:


  • Otherwise there was no INOUT-deal.

And this is questionable. Very questionable, in fact.

At this point I bid you farewell. I have no right to prevent you from getting lost...

 
Konstantin:

How to determine the closing time of the previous day's market in the futures market in different variants of the current time interval:

1. we are in the interval Saturday - Sunday; we need close time of the evening trading session on Friday
2. in the interval of Monday-Friday closed market: we need the closing time of evening session Monday-Thursday
3. we are in the trading range Monday and we need to close time of evening trading session on Friday
4. in Tuesday-Friday timeframe we need the closing time for Monday-Thursday evening sessions

Maybe someone wrote a similar functionality, I do not want to reinvent the wheel ))

Maybe this will do? It does not always show correctly in forex.

Документация по MQL5: Получение рыночной информации / SymbolInfoSessionTrade
Документация по MQL5: Получение рыночной информации / SymbolInfoSessionTrade
  • www.mql5.com
Получение рыночной информации / SymbolInfoSessionTrade - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5