• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData performance

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

  • guillembm
    started a topic OnMarketData performance

    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?

  • guillembm
    replied
    Thanks Chelsea.

    This is exactly the approach I took.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.

    https://ninjatrader.com/support/foru...345#post521345
    https://ninjatrader.com/support/foru...926#post486926
    https://ninjatrader.com/support/foru...576#post525576

    Leave a comment:


  • guillembm
    replied
    Yes, the order is correctly set to null. I was just wondering for a better option.

    Thanks

    Leave a comment:


  • NinjaTrader_Ray
    replied
    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?

    Leave a comment:


  • guillembm
    replied
    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.

    Leave a comment:


  • NinjaTrader_Ray
    replied
    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?

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by uiwislth, Yesterday, 11:25 PM
0 responses
4 views
0 likes
Last Post uiwislth  
Started by Steve L, Yesterday, 10:04 PM
0 responses
3 views
0 likes
Last Post Steve L
by Steve L
 
Started by marianfed, Yesterday, 09:47 PM
0 responses
4 views
0 likes
Last Post marianfed  
Started by hir04068, Yesterday, 09:29 PM
0 responses
2 views
0 likes
Last Post hir04068  
Started by iq200, 03-11-2018, 07:49 PM
24 responses
1,021 views
0 likes
Last Post mrlucky1x  
Working...
X