Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Optimization Result Issues

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

    Strategy Analyzer Optimization Result Issues

    I'm experiencing what I'd consider unexpected results when using the strategy optimizer..

    To demonstrate the issue I've modified the default SampleMACrossOver strategy.. The ONLY modifications I made is, I've just added 2 lines of code in the OnBarUpdate (lines 60 & 61) (Conditional Check for first Sunday or return) and then have Hard Coded the SMA Fast and Slow values in the State.Config to the default settings of 10 & 25 (lines 42 && 43) ..

    With the hard coding of the SMA values, I would now expect any optimization across either the Fast or Slow values to return the exact same results... But they don't...

    Stick this strat in the analyzer and optimize across a Fast of 10;25;1 .. (Remember this is now hard coded to 10, so ultimately any optimization here shouldn't make any different at all in the results).. I used CL 08-15, 1min chart, keeping 25 results, with pretty much everything else default (But it doesn't really matter what instrument/dataseries/settings you use, except you'll prob need 15-25 results).. The number of trades and profit results will end up being different..

    Seems also dependent on the computer/processor/cores as to the # of different results as well.. I tend to get around 7-8 of the same and then the rest different using an I7, where as another beta tester using the same strat tends to get between 4-5 and then the rest different using an I5.. This also seems a bit strange..

    Could someone explain to me why this is happening?


    Attached Files
    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    #2
    MTF Indicator w/Strategy

    Another question..

    I'm trying to use the exposed values of a multi-time frame indicator within a strategy.. I create a private indicator variable in the strategy and set/assign it to the indicator in the state.config..

    When running optimizations I get the error as shown in attached pic..

    The error goes away if I add the secondary data series used in the indicator to the strategy as well.. But I'm not sure why I should have to do this.. nor do I ever want to have to do this..

    Should this be expected?


    Attached Files
    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    Comment


      #3
      Hello,

      Thank you for the questions.

      For the first question, when I tested this in the optimization I only received 1 set of results or I should say 1 value for all optimizations as you had expected.

      This would indicate possibly a cache issue. One item that comes to mind would be IsInstantiatedOnEachOptimizationIteration:


      This state is listed in this document as SetDefaults but I have been informed this should be in Historical instead. I have submitted this for review as well to make sure the sample is correct or will get corrected.

      It could be possible the last values are still being used as the strategy is the same other than changing the value. Can you try this to see if this resolves the first question?

      For the second question,

      That would be expected, NinjaTrader 8 handles loading data differently than NinjaTrader 7, so in this case this would be a performance enhancing change. There are multiple reasons for this change but the main notes I had taken away from this were that this decreases the amount of bar requests that the strategy and its added scripts collectively would submit.

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

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        This would indicate possibly a cache issue. One item that comes to mind would be IsInstantiatedOnEachOptimizationIteration:


        It could be possible the last values are still being used as the strategy is the same other than changing the value. Can you try this to see if this resolves the first question?
        When adding

        Code:
        [COLOR=#080808]IsInstantiatedOnEachOptimizationIteration[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#0000ff]true[/COLOR][COLOR=#000000];[/COLOR]
        to the State.SetDefaults, I no longer experience this issue, and now get all the same values as expected... Thank You Very Much!

        Originally posted by NinjaTrader_Jesse View Post
        This state is listed in this document as SetDefaults but I have been informed this should be in Historical instead. I have submitted this for review as well to make sure the sample is correct or will get corrected.
        Just an FYI, when I add that to State.Historical (even using a dispatcher) I get the dreaded Threading Error.. "Strategy 'SampleMACrossOverTest': Error on calling 'OnStateChange' method: You are accessing an object which resides on another thread. I.E. creating your own Brush without calling .Freeze(), or trying to access a UI control from the wrong thread without using a Dispatcher."

        If you could confirm that State.SetDefaults is definitely where that should be, that would be greatly appreciated.. Thanks...

        Originally posted by NinjaTrader_Jesse View Post
        For the second question, That would be expected, NinjaTrader 8 handles loading data differently than NinjaTrader 7, so in this case this would be a performance enhancing change. There are multiple reasons for this change but the main notes I had taken away from this were that this decreases the amount of bar requests that the strategy and its added scripts collectively would submit.
        Interesting, I guess it's hard for me to get my head around how having to add an additional dataseries to a strategy that is never used in the strategy itself would help performance, but I'll take your word for it and adjust/code my strategies accordingly.. Thanks for the clarification...


        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #5
          Hello,

          Thank you for trying that, I am glad that was the solution.

          The correct state for this would be as the HelpGuide shows in SetDefaults.

          Regarding the strategy adding the dataseries, this is handled internally so in the case where an Indicator is called by a strategy and the Indicator is adding a series, the error will be listed in the log.

          When you Add the data series from the strategy as well, internally this is seen so the indicators request is ignored and the strategy has added the series. Instead of 2 data requests it would be reduced to 1 which would help with overall performance.

          I look forward to being of further assistance.
          Last edited by NinjaTrader_Jesse; 07-23-2015, 07:03 AM.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,261 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by WeyldFalcon, 12-10-2020, 06:48 PM
          14 responses
          1,428 views
          0 likes
          Last Post Handclap0241  
          Started by DJ888, 04-16-2024, 06:09 PM
          2 responses
          9 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          41 views
          0 likes
          Last Post jeronymite  
          Working...
          X