Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Hours / Time / Analyzer Effeciency

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

    #16
    I'm using the Enum to determine logic in if statements. Something like if enum == long. I could not find a way to do this without converting the values to strings which may be my first mistake but...

    I then need to the chosen enum value to persist in a way that it does not cause the Strategy Analyzer to fail on the detailed reports such as chart and trade. The wrong value is being sent for those reports(i believe the first) which causes the wrong logic to be triggered and the reports are wrong. I'm using the optimizer.

    I've found that the actual chosen property value is not returned for the detailed reports in the NS output. 'ModChoice' in this case.

    Code:
    		[NinjaScriptProperty]
    		[Display(ResourceType = typeof(Custom.Resource), Name = "ModeE", Description = "An Enum selector", GroupName = "Parameters", Order = 0)]
    		public _Enums.ModeEnum ModeChoice
    		{ get; set; }

    Comment


      #17
      Hello Dragon989,

      Thank you for your patience.

      Enums cannot be optimized in the Strategy Analyzer.

      It looks like the chosen Enum parameter does not persist at all regardless of any conversion when looking at the detailed analyzed results.
      What do you refer to as the "detailed analyzed results"? Can you provide a screenshot of this?

      There is no proper way to convert the enums. This would be scenario specific to what you wish to accomplish. If you need a string then check the value of the enum and set a string. A great example of checking enum values and setting another item based on the enum values can be viewed in our 'Creating a user-defined parameter type (enum)' example at the following link: https://ninjatrader.com/support/help...ned_parame.htm

      For ranges you need parameters that have ranges such as doubles and ints. Perhaps your string or enum that needs a range can be simplified to an int instead.

      I would like to clarify some additional items below from earlier in this thread.
      • In order to view optimized results based on a time range then you need to set up those parameters for your time filter and limit them for each test. So you would run one optimization with you 6:00 to 7:30 filter and one with your 7:30 to 8:00 filter. If you still need assistance with time filters please make sure to review our sample at the following link and let me know if you have any questions: https://ninjatrader.com/support/help...to_limit_t.htm
      • You cannot force an iteration to stop processing a session if outside a specific time filter nor can you force it to iterate by a different interval than the bar type, you can only filter your code with the time filter but the OnBarUpdate() function and others are still called for each bar in the collection for the session.

      Please let me know if you have any questions.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      62 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      134 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X