in a strategy that detects a flat position in OnPositionUpdate(), a flag is set so that the next time through OnBarUpdate() an email is sent about the closed trade. It only applies to realtime trades.
This works well and operates as expected on my development machine.
e.g.
20/05/2019 7:16:08 PM at DoClosedTradeReport(), State=Realtime, realtime trade count for NQ 06-19 = 1 Total trade count = 3
On the client's machine, however, the trade count always reports as zero, despite numerous historical and realtime trades occurring.
Here is a snippet of logging to show an entry and exit execution, followed by a trade count reporting zero.
Strategy execution update: execution='99b223346e6548aab318ba57ba72953b' instrument='EURUSD' account='Playback101' exchange=Default price=1.12621 quantity=1.000.000 marketPosition=Long orderId='0809eff6f2084be4973dbe1c6cb7591b' time='2019-06-04 08:15:57' sod=False statementDate='2019-06-04'
LE, 0809eff6f2084be4973dbe1c6cb7591b, AvgFill 1,12621, refPrice 1,1262, isEntry=True, isExit=False, official Slippage 0, custom Slippage 0,2
EXECUTION (Realtime): execution='99b223346e6548aab318ba57ba72953b' instrument='EURUSD' account='Playback101' exchange=Default price=1.12621 quantity=1.000.000 marketPosition=Long orderId='0809eff6f2084be4973dbe1c6cb7591b' time='2019-06-04 08:15:57' sod=False statementDate='2019-06-04'
Fill Long at 1,12621, calculating initial StopLoss 1,1242 and final Profit Target 1,1267, latest minute Close is 1,12585
04.06.2019 08:15:57 Strategy 'tzHighLow6/167000852': Entered internal SubmitOrderUnmanaged() method at 04.06.2019 08:15:57: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1.000.000 LimitPrice=1,1242'0 StopPrice=1,1242'0 SignalName='LS'
04.06.2019 08:15:57 Strategy 'tzHighLow6/167000852': Entered internal SubmitOrderUnmanaged() method at 04.06.2019 08:15:57: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1.000.000 LimitPrice=1,1267'0 StopPrice=1,1267'0 SignalName='LT'
Strategy execution update: execution='6047330545da424797d3f6a4ec58733c' instrument='EURUSD' account='Playback101' exchange=Default price=1.12674 quantity=1.000.000 marketPosition=Short orderId='480a1b043a104a28bbcbf36604cca86d' time='2019-06-04 08:50:33' sod=False statementDate='2019-06-04'
LT, 480a1b043a104a28bbcbf36604cca86d, AvgFill 1,12674, refPrice 1,1267, isEntry=False, isExit=True, official Slippage 0, custom Slippage -0,8
EXECUTION (Realtime): execution='6047330545da424797d3f6a4ec58733c' instrument='EURUSD' account='Playback101' exchange=Default price=1.12674 quantity=1.000.000 marketPosition=Short orderId='480a1b043a104a28bbcbf36604cca86d' time='2019-06-04 08:50:33' sod=False statementDate='2019-06-04'
04.06.2019 08:51:01 at DoClosedTradeReport(), State=Realtime, realtime trade count for EURUSD = 0 Total trade count = 0
The NinjaScript that produces that final line above, is this:
Print(Now+" at DoClosedTradeReport(), State="+State+", realtime trade count for "+Instrument.FullName+" = "+SystemPerformance.RealTimeTrades.Count
+" Total trade count = "+SystemPerformance.AllTrades.Count);
It works on my machine, it does not work on the client's. We are both running NT8.0.17.2.
Can you assist in figuring out the problem?
Many thanks,
saltminer
Comment