Different behavior in OnTradeTransaction with Strategy Tester and live demo account

 

Hello All,

In my EA I want to send an order and monitor its individual executions, if any. To do so I implemented the OnTradeTransaction() method to intercept each execution. However, I'm experiencing different behavior when running my code in the Strategy Tester and when running it  as if in production, but using my demo account. With the Strategy Tester I'm able to capture traded volumes when looking to MqlTradeTransaction where state is equal to TRADE_TRANSACTION_ORDER_DELETE and order_state is equal to  ORDER_STATE_FILLED or ORDER_STATE_PARTIAL. With the demo account volume is always zero. Bellow are some prints I did inside the OnTradeTrasaction method. The EA is not production ready yet, so I didn't try it with my real account. Is this behavior something expected? What should it be in production?

  

Staetegy Tester Log (transavtion volume is represente by "qty=")

=============

JO 0 08:48:06.942 Trade 2016.10.06 09:00:59   exchange sell 1.00 WDOX16 at 3254.500 (3254.500 / 3255.000 / 3254.500)

CM 0 08:48:06.942 Trades 2016.10.06 09:00:59   deal #2 sell 1.00 WDOX16 at 3254.500 done (based on order #2)

CO 0 08:48:06.942 Trade 2016.10.06 09:00:59   deal performed [#2 sell 1.00 WDOX16 at 3254.500]

JD 0 08:48:06.942 Trade 2016.10.06 09:00:59   order performed sell 1.00 at 3254.500 [#2 sell 1.00 WDOX16 at 3254.500]

HJ 0 08:48:06.944 FTT (WDOX16,M5) 2016.10.06 09:00:59   ==> Update: 2 type=TRADE_TRANSACTION_DEAL_ADD tside=ORDER_TYPE_BUY st=ORDER_STATE_STARTED qty=1.0 px=3254.5 pos=2

EQ 0 08:48:06.944 FTT(WDOX16,M5) 2016.10.06 09:00:59   ==> Update: 2 type=TRADE_TRANSACTION_ORDER_DELETE tside=ORDER_TYPE_SELL st=ORDER_STATE_FILLED qty=1.0 px=3254.5 pos=2

 

Live Demo Acct Log

=============

PF 0 09:01:16.743 FTT(WDOX16,M15) ==> Update: 25598554 type=TRADE_TRANSACTION_ORDER_ADD tside=ORDER_TYPE_BUY st=ORDER_STATE_STARTED qty=1.0 px=0.0 pos=0

FK 0 09:01:16.743 FTT(WDOX16,M15) ==> Update: 25598554 type=TRADE_TRANSACTION_ORDER_DELETE tside=ORDER_TYPE_BUY st=ORDER_STATE_FILLED qty=0.0 px=0.0 pos=25598508


Thank you,

Fábio 

 
Fabio Bissolotti:

Hello All,

In my EA I want to send an order and monitor its individual executions, if any. To do so I implemented the OnTradeTransaction() method to intercept each execution. However, I'm experiencing different behavior when running my code in the Strategy Tester and when running it  as if in production, but using my demo account. With the Strategy Tester I'm able to capture traded volumes when looking to MqlTradeTransaction where state is equal to TRADE_TRANSACTION_ORDER_DELETE and order_state is equal to  ORDER_STATE_FILLED or ORDER_STATE_PARTIAL. With the demo account volume is always zero. Bellow are some prints I did inside the OnTradeTrasaction method. The EA is not production ready yet, so I didn't try it with my real account. Is this behavior something expected? What should it be in production?

  

Staetegy Tester Log (transavtion volume is represente by "qty=")

=============

JO 0 08:48:06.942 Trade 2016.10.06 09:00:59   exchange sell 1.00 WDOX16 at 3254.500 (3254.500 / 3255.000 / 3254.500)

CM 0 08:48:06.942 Trades 2016.10.06 09:00:59   deal #2 sell 1.00 WDOX16 at 3254.500 done (based on order #2)

CO 0 08:48:06.942 Trade 2016.10.06 09:00:59   deal performed [#2 sell 1.00 WDOX16 at 3254.500]

JD 0 08:48:06.942 Trade 2016.10.06 09:00:59   order performed sell 1.00 at 3254.500 [#2 sell 1.00 WDOX16 at 3254.500]

HJ 0 08:48:06.944 FTT (WDOX16,M5) 2016.10.06 09:00:59   ==> Update: 2 type=TRADE_TRANSACTION_DEAL_ADD tside=ORDER_TYPE_BUY st=ORDER_STATE_STARTED qty=1.0 px=3254.5 pos=2

EQ 0 08:48:06.944 FTT(WDOX16,M5) 2016.10.06 09:00:59   ==> Update: 2 type=TRADE_TRANSACTION_ORDER_DELETE tside=ORDER_TYPE_SELL st=ORDER_STATE_FILLED qty=1.0 px=3254.5 pos=2

 

Live Demo Acct Log

=============

PF 0 09:01:16.743 FTT(WDOX16,M15) ==> Update: 25598554 type=TRADE_TRANSACTION_ORDER_ADD tside=ORDER_TYPE_BUY st=ORDER_STATE_STARTED qty=1.0 px=0.0 pos=0

FK 0 09:01:16.743 FTT(WDOX16,M15) ==> Update: 25598554 type=TRADE_TRANSACTION_ORDER_DELETE tside=ORDER_TYPE_BUY st=ORDER_STATE_FILLED qty=0.0 px=0.0 pos=25598508


Thank you,

Fábio 

Hi Fábio,

I just stumbled upon the same issue and wonder if you know how to solve this?!

How can I test my EA when the trade transaction events do not occur in the tester?

Is there any solution for this?


Thx a lot

fakir_trader