Comment in MT5 trading history report - page 3

 
fxsaber #:

Try attached EX5-file.

Yes.

Many Thanks!  It works!

 
Fernando Carreiro #:

I based it on your opening sentence ... " I want to analyse each EA ", but don't worry about it too much! Some times questions are somewhat ambiguous and it is difficult to decide in which section they belong.

Everything on the forum is geared towards MT5/MQL5, except for a single section at the end which is reserved for the older MT4/MQL4.

You mean if there is an EA trading issue on MT4, we should post not to EA and automated trading but to MQL4/MT5?

 

Forum on trading, automated trading systems and testing trading strategies

Comment in MT5 trading history report

fxsaber, 2023.11.17 12:43

#property script_show_inputs

input long inTicket = 0; // Position Ticket

void OnStart()
{
  if (HistorySelectByPosition(inTicket))
    Alert(HistoryOrderGetString(HistoryOrderGetTicket(0), ORDER_COMMENT));
}

This is one of the worst examples for beginners and produces insanely slow code!


It's better to do it this way.

#property script_show_inputs

input long inTicket = 0; // Position Ticket

void OnStart()
{
  if (HistorySelect(0, INT_MAX))
    Alert(HistoryOrderGetString(inTicket, ORDER_COMMENT));
}

It is probably important to realize what consequences these answers may have.

 
Mitsuru #: You mean if there is an EA trading issue on MT4, we should post not to EA and automated trading but to MQL4/MT5?

Yes, that is the idea! Anything related to MT4/MQL4 should be posted to the MQL4 and MetaTrader 4 section. All other sections are for MT5/MQL5.

This is for making answers compatible, so that you don't get MT5/MQL5 answers for MT4/MQL4 questions (and vice versa).

 
fxsaber #:

これは初心者にとって最悪の例の 1 つであり、非常に遅いコードが生成されます。


このようにした方が良いです。

これらの答えがどのような結果をもたらす可能性があるかを理解することがおそらく重要です。

I see. I'd written the bad oen..   Thanks.

 
Fernando Carreiro #:

はい、それがアイデアです! MT4/MQL4 に関連するものはすべて、MQL4 および MetaTrader 4セクションに投稿する必要があります。他のすべてのセクションは MT5/MQL5 用です。

これは、MT4/MQL4 の質問に対して MT5/MQL5 の回答が得られないように、回答に互換性を持たせるためです (逆も同様)。

I didn't know that. Understood.

Thanks.

 

Insider.

#property script_show_inputs

#include <HistoryPosition.mqh> // https://www.mql5.com/ru/blogs/post/755007

input long inTicket = 0; // Position Ticket

void OnStart()
{
  if (HistoryPositionSelect(inTicket))
    Alert(HistoryPositionGetString(POSITION_HISTORY_COMMENT));
}
HistoryPosition - неопубликованный функционал MQL5-языка.
HistoryPosition - неопубликованный функционал MQL5-языка.
  • www.mql5.com
HistoryPositionSelect Выбирает закрытую позицию для дальнейшей работы с ней по указанному тикету. Возвращает true при успешном завершении функции. Возвращает false при неудачном завершении функции