Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unlock code optimization

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

    unlock code optimization

    Hi,

    It seems to me that everytime i unlock a strategy and add some code, I can no longer perform optimization. I've tried unlocking code as well as using the multi time frame strategy. I opened the multi time frame code, saved as my multi time frame and then I never see any optimization parameters.

    How can I optimize on any strategy after unlocking the code?

    Thanks,
    John

    #2
    John, would you mind attaching a sample script that you tried to optimize so we could review the properties you use? The sample MultiTimeFrame would indeed not have anything to optimize per se, so that outcome I would expect.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand, below is my code. From using the UI, I can optimize base on my defined variables, but it seems as after I unlock the code, if I add any defined variable, or for the multi time frame code below, even with my defined variables, nothing shows up on the Optimization Wizard.


      public class Min1Min5Rsi2 : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int rSI30 = 30; // Default setting for RSI30
      private int rSI70 = 70; // Default setting for RSI70
      private int eMA10 = 10; // Default setting for EMA10
      // User defined variables (add any user defined variables below)

      /// </summary>
      protected override void Initialize()
      {
      // Add a 5 minute Bars object to the strategy
      Add(PeriodType.Minute, 1);
      Add(PeriodType.Minute, 5);
      Add(RSI(2, 3));
      Add(EMA(10));

      CalculateOnBarClose = true;
      }

      protected override void OnBarUpdate()
      {

      if (BarsInProgress != 0)
      return;

      if (RSI(BarsArray[1], 2, 3)[0] < rSI30 && RSI(BarsArray[2], 2, 3)[0] > rSI70)

      {

      EnterLong(DefaultQuantity, "Long1");
      }

      Comment


        #4
        Hi john_robertson00,

        Variables must be made public for it to be optimized.

        Please take a look at the SMA indicator with the Period variable.

        In the Properties region at the bottom, please expand this and look at the public declaration for Period.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          Great stuff. I did not know I needed to make them public. After setting them, all shows up correctly in the optimization.
          Thanks,
          JR

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by f.saeidi, Today, 05:56 AM
          1 response
          3 views
          0 likes
          Last Post Jltarrau  
          Started by Jltarrau, Today, 05:57 AM
          0 responses
          4 views
          0 likes
          Last Post Jltarrau  
          Started by Stanfillirenfro, Yesterday, 09:19 AM
          7 responses
          51 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by TraderCro, 04-12-2024, 11:36 AM
          4 responses
          70 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Mindset, Yesterday, 02:04 AM
          1 response
          15 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X