Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization crashes when just optimizing three variables!!

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

    Optimization crashes when just optimizing three variables!!

    Was hoping the ninjatrader customer support could help me out.

    I"m trying to optimize a strategy (only 3 variables) and getting frustrated that my ninjatrader crashes as it runs out of memory.

    I"m running a an Intel i5 @3.1 Ghz with 6 GB memory.

    I can email my code and traces.

    Any help on how I can clean up my code so I can optimize more than 3 variables would be greatly appreciated.

    Thanks

    Dave

    #2
    Originally posted by djoyce854 View Post
    Was hoping the ninjatrader customer support could help me out.

    I"m trying to optimize a strategy (only 3 variables) and getting frustrated that my ninjatrader crashes as it runs out of memory.

    I"m running a an Intel i5 @3.1 Ghz with 6 GB memory.

    I can email my code and traces.

    Any help on how I can clean up my code so I can optimize more than 3 variables would be greatly appreciated.

    Thanks

    Dave
    How many stocks or things are you trading?

    How many trades are you trying to execute per whatever time frame you are trading?

    Does your memory usage spike and go crazy in Task Manager?

    Can you reproduce with a SMA crossover strategy? Or is it related only with your strategy in question??

    Something doesn't appear right for sure...

    Hopefully NT can explain this one...

    Comment


      #3
      Hi Sledge,

      I'm optimization the CL contract going a month back on range bars. Some reproduce over 1000 trades during this period.Ya and my memory spikes in task manager. RIght now i'm optimizing one variable "ADXVMA" and two others that deal with profit target and trailing stop.

      I just tried the same period on the sample ma strategy and the memory barely went higher than my pc at idle.

      I am using one indicator, three times, and the indicator alone has 7 variables inside it. However, i'm not optimizing the variable inside the indicator, just like i said above, adxvma and profit/stop targets. Could that be reason why?

      Comment


        #4
        What type are these variables? int, double, enum, etc?

        what is the range you're testing on each variable?

        If you're able to could you post a simplified version of your strategy that replicates the issue?
        LanceNinjaTrader Customer Service

        Comment


          #5
          Sure, I"ll just post the main part of the code here. Any help on how I can make the optimization more efficient would be greatly appreciated.

          The variable i'm trying to optimize for instance would be iperiod1, iperiod2 and iperiod 3. The range would be 4 with an increment of 1. (For example Min:1 Max:4 Increment:1)

          I"m testing it on a future contract for just a weeks worth of tick data.


          #region Variables
          // Wizard generated variables
          private int sharesinplay = 1; // Default setting for Sharesinplay
          private int ilperiod1 = 2; //Laguerre Period(or Order,max=10)
          private int iadaptlength1 = 2; //Adaptive Factor Length
          private int igammasmooth1 = 2; //Gamma Smoothing Period
          private int igammasmoothmode1 = 3; //Gamma Smoothing Mode (0...19)
          private int ilperiod2 = 5; //Laguerre Period(or Order,max=10)
          private int iadaptlength2 = 10; //Adaptive Factor Length
          private int igammasmooth2 = 5; //Gamma Smoothing Period
          private int igammasmoothmode2 = 10; //Gamma Smoothing Mode (0...19)
          private int ilperiod3 = 10; //Laguerre Period(or Order,max=10)
          private int iadaptlength3 = 20; //Adaptive Factor Length
          private int igammasmooth3 = 10; //Gamma Smoothing Period
          private int igammasmoothmode3 = 19; //Gamma Smoothing Mode (0...19)

          // User defined variables (add any user defined variables below)
          #endregion

          /// <summary>
          /// This method is used to configure the strategy and is called once before any strategy method is called.
          /// </summary>
          protected override void Initialize()
          {
          Add(AdaptiveLaguerre(iadaptlength1, 1, 2, igammasmooth1, igammasmoothmode1, ilperiod1, 0.38, 2));
          Add(AdaptiveLaguerre(iadaptlength2, 1, 2, igammasmooth2, igammasmoothmode2, ilperiod2, 0.38, 2));
          Add(AdaptiveLaguerre(iadaptlength3, 1, 2, igammasmooth3, igammasmoothmode3, ilperiod3, 0.38, 2));

          CalculateOnBarClose = true;

          }

          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          // Condition set 1
          if (Position.MarketPosition == MarketPosition.Flat)
          {
          if (((AdaptiveLaguerre(BarsArray[0],iadaptlength1, 1, 2, igammasmooth1, igammasmoothmode1,
          ilperiod1, 0.38, 2).MovAvgUp[0] == AdaptiveLaguerre(BarsArray[0],iadaptlength1, 1, 2, igammasmooth1, igammasmoothmode1,
          ilperiod1, 0.38, 2).Laguerre[0]))
          &&
          ((AdaptiveLaguerre(BarsArray[0],iadaptlength2, 1, 2, igammasmooth2, igammasmoothmode2,
          ilperiod2, 0.38, 2).MovAvgUp[0] ==
          AdaptiveLaguerre(BarsArray[0],iadaptlength2, 1, 2, igammasmooth2, igammasmoothmode2,
          ilperiod2, 0.38, 2).Laguerre[0]))
          &&
          ((AdaptiveLaguerre(BarsArray[0],iadaptlength3, 1, 2, igammasmooth3, igammasmoothmode3,
          ilperiod3, 0.38, 2).MovAvgUp[0] == AdaptiveLaguerre(BarsArray[0],iadaptlength3, 1, 2, igammasmooth3, igammasmoothmode3,
          ilperiod3, 0.38, 2).Laguerre[0] )))
          {
          EnterLong(Sharesinplay, "Long");
          }

          if (((AdaptiveLaguerre(BarsArray[0],iadaptlength1, 1, 2, igammasmooth1, igammasmoothmode1,
          ilperiod1, 0.38, 2).MovAvgDn[0] == AdaptiveLaguerre(BarsArray[0],iadaptlength1, 1, 2, igammasmooth1, igammasmoothmode1,
          ilperiod1, 0.38, 2).Laguerre[0]))
          &&
          ((AdaptiveLaguerre(BarsArray[0],iadaptlength2, 1, 2, igammasmooth2, igammasmoothmode2,
          ilperiod2, 0.38, 2).MovAvgDn[0] ==
          AdaptiveLaguerre(BarsArray[0],iadaptlength2, 1, 2, igammasmooth2, igammasmoothmode2,
          ilperiod2, 0.38, 2).Laguerre[0]))
          &&
          ((AdaptiveLaguerre(BarsArray[0],iadaptlength3, 1, 2, igammasmooth3, igammasmoothmode3,
          ilperiod3, 0.38, 2).MovAvgDn[0] == AdaptiveLaguerre(BarsArray[0],iadaptlength3, 1, 2, igammasmooth3, igammasmoothmode3,
          ilperiod3, 0.38, 2).Laguerre[0] )))
          {
          EnterShort(Sharesinplay, "Short");
          }

          Comment


            #6
            Disregard the BarsArray[0] in the code as that is no longer there.

            Comment


              #7
              Based on what I can see here my guess is that the issue is with the AdaptiveLaguerre indicator.

              I dont know if this is one you've created or from a third party but I'm assuming the indicator is very intensive.

              Does this indicator contain any loops?
              LanceNinjaTrader Customer Service

              Comment


                #8
                I just started programming so i'm not sure how to find loops. I'll just chalk it up to the indicator being very cpu intensive. As long as writing the strategy is ok, then i'll plot along. Thanks for your help Lance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Aviram Y, Today, 05:29 AM
                0 responses
                1 view
                0 likes
                Last Post Aviram Y  
                Started by quantismo, 04-17-2024, 05:13 PM
                3 responses
                25 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by ScottWalsh, 04-16-2024, 04:29 PM
                7 responses
                34 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by cls71, Today, 04:45 AM
                0 responses
                6 views
                0 likes
                Last Post cls71
                by cls71
                 
                Started by mjairg, 07-20-2023, 11:57 PM
                3 responses
                216 views
                1 like
                Last Post PaulMohn  
                Working...
                X