ReLor2:
Hi,
i try to understand why the following if-statement not works.
i wondering, in the journal i see my "infoprint" with "ticket:4 > Type: TRADE_TRANSACTION_DEAL_ADD > Deal_entry (DEAL_ENTRY_IN [0]): 1/DEAL_ENTRY_OUT" and the part "do on entry in" from inside this if-statement.
So normaly the simple statement will compare if(0==0), but if it is the infoprint should not printout because DEAL_ENTRY_OUT ist not 0, it should be 1..!?
Did i have to comare enum-fields in a special way!?
Hi,
i try to understand why the following if-statement not works.
i wondering, in the journal i see my "infoprint" with "ticket:4 > Type: TRADE_TRANSACTION_DEAL_ADD > Deal_entry (DEAL_ENTRY_IN [0]): 1/DEAL_ENTRY_OUT" and the part "do on entry in" from inside this if-statement.
So normaly the simple statement will compare if(0==0), but if it is the infoprint should not printout because DEAL_ENTRY_OUT ist not 0, it should be 1..!?
Did i have to comare enum-fields in a special way!?
You should try it like this
void OnTradeTransaction(const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { ulong ticket = 0; if(!HistoryDealSelect(trans.deal)) return; else ticket = trans.deal; if((ENUM_DEAL_ENTRY)HistoryDealGetInteger(ticket, DEAL_ENTRY) == DEAL_ENTRY_IN) { Print(EnumToString(DEAL_ENTRY_IN)); } }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i try to understand why the following if-statement not works.
i wondering, in the journal i see my "infoprint" with "ticket:4 > Type: TRADE_TRANSACTION_DEAL_ADD > Deal_entry (DEAL_ENTRY_IN [0]): 1/DEAL_ENTRY_OUT" and the part "do on entry in" from inside this if-statement.
So normaly the simple statement will compare if(0==0), but if it is the infoprint should not printout because DEAL_ENTRY_OUT ist not 0, it should be 1..!?
Did i have to comare enum-fields in a special way!?