Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData performance

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

    OnMarketData performance

    I am trying to improve strategy performance and I am detecting that OnMarketData is using loads of CPU.

    I only need OnMarketData to load data while an order is working. Would it be possible to stop OnMarketData loading data when no orders are working in the strategy?

    Is there any other option to reduce OnMarketData CPU usage?

    #2
    Originally posted by guillembm View Post
    I am trying to improve strategy performance and I am detecting that OnMarketData is using loads of CPU.

    I only need OnMarketData to load data while an order is working. Would it be possible to stop OnMarketData loading data when no orders are working in the strategy?

    Is there any other option to reduce OnMarketData CPU usage?
    Can you not return out of the method immediately when there are no orders working?
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray.

      This is the option I am trying. This will avoid proccessing code when no orders are working.

      Sort of:
      if (MyOrder = null)
      return;

      But, this will still keep on loading data in the method.

      I was wondering if there is a way to stop loading data.

      Comment


        #4
        Originally posted by guillembm View Post
        Thanks Ray.

        This is the option I am trying. This will avoid proccessing code when no orders are working.

        Sort of:
        if (MyOrder = null)
        return;

        But, this will still keep on loading data in the method.

        I was wondering if there is a way to stop loading data.
        If you override the method then that method will be called. That in itself (if there is no code to process) will not cause a CPU load whatsoever. My guess is that MyOrder is never null? Have you checked?
        RayNinjaTrader Customer Service

        Comment


          #5
          Yes, the order is correctly set to null. I was just wondering for a better option.

          Thanks

          Comment


            #6
            Hello guillembm,

            Your logic would need to control this within the script.

            It would be possible to create a bool in the script that is true when any orders are alive and set to false once all orders are State.Filled or State.Cancelled.
            Or you could create an array that holds the order objects and check that all open orders are not filled or cancelled.

            Many of the example scripts I have check for this.


            Support for the development of custom automated trading strategies using NinjaScript.

            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks Chelsea.

              This is exactly the approach I took.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by manitshah915, Today, 12:59 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by ursavent, Today, 12:54 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cre8able, Today, 01:01 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Mizzouman1, Today, 07:35 AM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by RubenCazorla, Today, 09:07 AM
              2 responses
              13 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X