Forum

Code snippet to calculate profit in MQL5 using OnTradeTransaction callback

Apologies for inappropriate formatting. If I attempt to format the code in code block, a big block shows up. If use HTML button on RHS, entire typed text disappears... First of all, we need a global variable to hold the profit's calculation. In case you are tracking multiple EA's at once you may

Need to understand Difference MQL4 vs MQL5 iCustom function

MQL4 vs MQL5 iCustom function Above image is from MQL4 documenation and lower is from MQL5. mode and shift parameter in MQL4 are missing but important. They are absent even in IndicatorCreate so I am confused as to how to handle supplying of mode and shift parameter

OnTradeTransaction consitently getting called invoked with incorrect values in

/// Following code always line with message "Filled Long " even when order sell is filled. void OnTradeTransaction ( const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { double postn_price, postn_volume; long postn_magic; CDealInfo