Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing file path?

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

    Changing file path?

    When I ran the strategy optimizer, it slowed down exponentially!
    I figured it might be because the drive it assign to save the data is too small!
    Is there anyway that I could change it to a bigger drive so it could run more smoothly?
    Thank you very much for your help!

    #2
    Thank you very much!

    Comment


      #3
      Hi YoutingChu,

      Have you taken advantage of the IsInstantiatedOnEachOptimizationIteration?



      If your script is structured to declare objects in the scope of the indicator class but initialize objects in State.DataLoaded, or any state after this, only if you need a new object (or reset them if a new object is not needed), this would allow NinjaTrader to use much less resources when optimizing.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you very much!
        I'll go research it!
        Last edited by YoutingChu; 10-05-2017, 09:26 AM.

        Comment


          #5
          It's not working!!! It still got stocked at the 4th iteration!!!
          I wrote a VERY simple strategy! And it still got stocked at the "4th" iteration!
          I can't imagine how will it be like if I write more complicate strategies!!!
          How do you guys save the processing data? I'm very curious!!!

          Comment


            #6
            Hello YoutingChu,

            Thank you for your update on this matter.

            Can you send us your strategy so we may look into this matter further?

            You can export your strategy by going to Tools > Export > NinjaScript Add On > Add > select your strategy > OK > Export > name the file 'NTsupport' > Save. The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript. Please attach the file to your response.

            If you prefer you can send it over to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

            I look forward to assisting you further.

            Comment


              #7
              private int inOut,i=0;
              private double stopPrice;

              protected override void OnStateChange()
              {
              if (State == State.SetDefaults)
              {
              //...
              IsInstantiatedOnEachOptimizationIteration = false;
              StopReverse = 1;

              }
              else if (State == State.Configure)
              {
              }
              else if (State == State.DataLoaded)
              {
              inOut=0;
              }
              }

              protected override void OnBarUpdate()
              {
              if (CurrentBars[0] < 2)
              return;

              if(inOut==0)
              {
              if(Close[0]>Close[1])
              {
              inOut=1;
              stopPrice=Low[0]-StopReverse;
              }
              else
              {
              inOut=-1;
              stopPrice=High[0]+StopReverse;
              }
              Log(i.ToString(),LogLevel.Alert);
              i++;
              return;
              }
              }

              According to you, the log here should be increasing every iteration because the very first line is only ran once, right!?
              But it's NOT! It's ALL 0!!!
              Which means it still been instantiated every run!!! And therefore eat up all my resources!!! Why!?!?!? Where did I do wrong!?!?!?
              Thank you very very much for helping me!!!

              Comment


                #8
                Hello YoutingChu,

                Optimizer will start a strategy for each core on the PC even if IsInstantiateOnEachOptimization is false since thats how we use all the cores on the machine in an optimization. Optimizations do not run in sequence but in parallel.

                A great way to observe this is to use generate an ID to track the instance.

                Attached is the script I have tested.
                IsInstantiatedOnEachOptimizationIterationTest_NT8. zip
                Attached Files
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  In your example, the "Counter" increased! But mine doesn't!!! Why!?!?!?

                  Comment


                    #10
                    Hello YoutingChu,

                    Thank you for your response.

                    I was seeing that your example did not increase on my end as well. I tested some items between your example and my colleague Chelsea's. I now have a working version of your example but it appears to be identical to what you provided.

                    Please review the attached version of your example and let me know what you find.
                    Attached Files

                    Comment


                      #11
                      Now I'm even more confused!!!
                      How come identical strategies will yield different outcomes!?!?!?

                      Comment


                        #12
                        Hello YoutingChu,

                        Thank you for your response.

                        This could be an issue in the original file such as incorrect information in a line of code or the file itself is corrupted. You could attempt to debug the file further or create a new file and manually write the code again avoiding 'copy and paste' to ensure no incorrect lines are brought over.

                        In any case you now have two examples of the working code. Please let me know if you have any questions.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by gravdigaz6, Today, 11:40 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post gravdigaz6  
                        Started by MarianApalaghiei, Today, 10:49 PM
                        3 responses
                        9 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by XXtrader, Today, 11:30 PM
                        0 responses
                        3 views
                        0 likes
                        Last Post XXtrader  
                        Started by love2code2trade, Yesterday, 01:45 PM
                        4 responses
                        28 views
                        0 likes
                        Last Post love2code2trade  
                        Started by funk10101, Today, 09:43 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post funk10101  
                        Working...
                        X