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

Implement multithreading in a strategy

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

    Implement multithreading in a strategy

    Hello,

    Is it possible to implement in ninjatrader a method inside one's strategy that would be called on a different thread.

    The reason I am asking is because I do use the OnMarketData method that is computationally intensive, so I would like to have a thread dedicated to this, but I also have a method called on a timer that checks the data and the current orders, may place new orders etc. I would like to have both running on different thread as currently, I notice that the timer keeps on deviating, i.e. say this is a 30 s timer, it will deviate from the 30 sec mark, and after say 100 calls, I would have seen 30010 seconds gone by (this is just for illustration).

    Hence I hope multithreading would help to avoid this issue? If not any other solution? And if it would, could you please provide me an example on how to actually implement this multithreading in ninja trader?

    Thanks

    #2
    Hello.

    Thanks for the note.

    Advanced threading and deviating from the event-driven model in NinjaScript is not supported. You can look at the BarTimer indicator's code to get an idea of how you could dispatch some code asynchronously and use the tick event method to read/update data.

    Please let us know if you have any questions.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by junkone, Today, 11:37 AM
    0 responses
    2 views
    0 likes
    Last Post junkone
    by junkone
     
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    34 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by proptrade13, Today, 11:06 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    34 views
    0 likes
    Last Post love2code2trade  
    Started by cls71, Today, 04:45 AM
    2 responses
    10 views
    0 likes
    Last Post eDanny
    by eDanny
     
    Working...
    X