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

Strategy Processing Bottleneck

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

    Strategy Processing Bottleneck

    Hello there

    I've a strategy which works great on backtest, but causes my PC to freeze up when I run it in real time - i believe purely from having to perform too many calculations befor the next onBarUpdate arrives.

    The strategy involves looping through multiple instances of an indicator i've written, with an ever decreasing parameter value.

    The indicator is visually similar to Bollinger Bands, so in the following example I use "Bollinger Band" to signfy my indicator.

    The strategy starts with an arbitrary Bollinger Band parameter value, say 20, and looks for a trade signal, then runs the strategy with a parameter 1 unit less (19) and looks for a trade signal etc.. etc.. When it generates a trade signal a Limit order is enterred (EnterLongLimit or EnterShortLimit).

    The nature of the strategy is to have lots of buy and sell signals below and above the market, ready to take advantage of spikes below and above the BollingerBand style indicator. For this reason there are many many orders enterred every minute and only a fraction of which are ever executed.

    Ideally i'd like to run this strategy on all the liquid futures markets concurrently, as in backtests its dose very well. However, in its current form I can't even run it on one market without causing a freeze up.

    Any suggestions greatly appreciated!

    Code is attached.

    Cheers
    Ben Heaton
    Attached Files
    Last edited by BenHeaton; 03-03-2008, 03:41 PM.

    #2
    If you call an indicator method in a loop by where your parameter values change with each iteration can definitely cause performance issues depending on how many method call variations you make.

    When you call an indicator method, an internal instance of an indicator is created and added to a cache. Futures calls to this method loop through this cache in order to get the correct indicator instance or if one is not found, create a new one. Continuously looping through this internal cache can have performance impact.
    RayNinjaTrader Customer Service

    Comment


      #3
      Tks Ray - that gives me some insight. Given that it doesn't look feasible to stream line the looping strategy, would u agree it makes sense when running the strategy live from the strategy tab, to only have a few hundred minutes worth of historical data (enough to cal the indicators).

      If i then leave the strategy on for 24 hrs trading a futures contract the historical data tail is going to grow and potentially start to slow down the processing. Is there any way that i can set the strategy to only generate the indicators for the most recent "x" 1 minute bars?

      Tks
      Ben

      Comment


        #4
        Its always adviseable to run as lean as possible so yes, having a sufficient amount of historical data to drive the min requirements of your strategy calculations is desireable.

        Not at this time however, we are looking at ways for NT7 to improve in this area.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by lorem, Today, 09:18 AM
        0 responses
        2 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by hazylizard, Today, 08:38 AM
        4 responses
        11 views
        0 likes
        Last Post hazylizard  
        Started by geddyisodin, Today, 05:20 AM
        2 responses
        18 views
        0 likes
        Last Post geddyisodin  
        Started by Max238, Today, 01:28 AM
        5 responses
        47 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by giulyko00, Yesterday, 12:03 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X