no DEAL_ENTRY_OUT

 

Hi guys, I am very new to this platform so please bare with me...

I have recently started building an ea using mql5. I have coded it in such a way that if the previous DEAL_ENTRY_OUT returns a negative profit value, the buy/sell will not be executed until a new bar has been printed.

As part of the debugging, I have included comments to display the deal ticket number. What I have noticed so far is that it does not display any DEAL_ENTRY_OUT tickets. The DEAL_ENTRY_OUT was initially used as condition which NEVER returned true. 

Can anyone confirm if this is a bug or has experienced the same issue? If not, is there anything I can do to work around it?

This is a snippet of the code:

   //time interval of trade history needed

   datetime timeEnd = TimeTradeServer();

   datetime timeStart = timeEnd - PeriodSeconds(PERIOD_H12);

   

   //Cache trade history for the selected time interval

   HistorySelect(timeStart, timeEnd);

   

   //get number of deals between start and end time

   int numberOfDeals = HistoryDealsTotal();

   

   //get deal ticket

   ulong dealTicket = HistoryDealGetTicket(numberOfDeals-1);

   

   ENUM_DEAL_TYPE dealType = (ENUM_DEAL_TYPE)HistoryDealGetInteger(dealTicket,DEAL_TYPE);

   double profit = HistoryDealGetDouble(dealTicket,DEAL_PROFIT);

   ENUM_DEAL_ENTRY dealEntry = (ENUM_DEAL_ENTRY)HistoryDealGetInteger(dealTicket,DEAL_ENTRY);

   

   Comment(dealTicket);
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
A deal is the reflection of the fact of a trade operation execution based on an order that contains a trade request. Each trade is described by properties that allow to obtain information about it. In order to read values of properties, functions of the Identifier of a position, in the opening, modification or closing of which this deal took...
 
Please edit your post and
use the code button (Alt+S) when pasting code
 
Keith Watford:
Please edit your post and
use the code button (Alt+S) when pasting code
Done. Thank you.
 
Jordan Lee Williams:

Hi guys, I am very new to this platform so please bare with me...

I have recently started building an ea using mql5. I have coded it in such a way that if the previous DEAL_ENTRY_OUT returns a negative profit value, the buy/sell will not be executed until a new bar has been printed.

As part of the debugging, I have included comments to display the deal ticket number. What I have noticed so far is that it does not display any DEAL_ENTRY_OUT tickets. The DEAL_ENTRY_OUT was initially used as condition which NEVER returned true. 

Can anyone confirm if this is a bug or has experienced the same issue? If not, is there anything I can do to work around it?

This is a snippet of the code:

Have you fund the reason of such behavior? Just bumped into the same situation

No mater .. position oppened DEAL_ENTRY_IN .... closed DEAL_ENTRY_IN ... the funny thing is that  DEAL_ENTRY_OUT used to be exists and it was fully working code