Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

SystemPerformance always reporting Count of zero

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SystemPerformance always reporting Count of zero

    Hi,
    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

    #2
    Hello saltminer,

    I see that the account listed in these notes is the Playback101 account, were you also using playback in your test? I just wanted to confirm the same situation is being observed between you and the user as you noted this was happening for live trades.

    I can see on my end that the print works in playback by duplicating the SampleMACrossOver and adding your print. For this question, I would likely suggest that you do the same or create a duplicate of the sample and add a simple print to OnBarUpdate to see if the user can see that work.

    Code:
    protected override void OnBarUpdate()
            {
                if (CurrentBar < BarsRequiredToTrade)
                    return;
    
                if (CrossAbove(smaFast, smaSlow, 1))
                    EnterLong();
                else if (CrossBelow(smaFast, smaSlow, 1))
                    EnterShort();
    
                Print(SystemPerformance.RealTimeTrades.Count + " Total trade count = " + SystemPerformance.AllTrades.Count);
            }
    If the sample logic with the print does not work, that will provide enough information to exclude your custom logic so we can troubleshoot the users platform, otherwise if that test works we could focus on items surrounding the strategy. You could additionally go one step further in creating two samples as you noted yours deals with OnPositionUpdate, if this somehow plays into the problem the more simple example may not exhibit the problem. I would likely suggest to test both simple logic from the SampleMaCrossOver and also one with OnPositionUpdate to see if there is any notable differences.

    On a side note, there is an update available which you and the user could do when you have some time. I don't see that anything specifically was addressed in the update that relates to this situation, however keeping up to date is always good.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,
      the client has run this strategy and it reports a trade count of zero. Therefore you will need to engage with him to troubleshoot his platform. I'll email you via support at ninjatrader.com

      Thanks,
      saltminer

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      1 view
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      383 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      1 view
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Working...
      X