Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Need help with scaling out strategy.

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

    Need help with scaling out strategy.

    Hi,

    I am having problems running a strategy in SIM on multiple symbols where at times many error messages appear (see attached) and the strategy is also disabled at times.

    The first thing I noticed is when you use currency the amount is for the entire position is this correct?

    I used one of the sample strategy scaling out example strategies and here is a snippet of the strategy:

    Can someone please let me know what is wrong thank you very much?

    PTarget1 = 500;
    PTarget2 = 900;
    PTarget3 = 1200;
    PTarget4 =1400;
    PTarget5 = 2500;
    TStop = 200;
    InitStop = 20;
    ProcessHours_Initialize();
    }
    else if (State == State.Configure)
    {
    ProcessHours_OnStartUp();
    SetProfitTarget("Long 1a", CalculationMode.Currency, PTarget1);
    SetProfitTarget("Long 1b", CalculationMode.Currency, PTarget2);
    SetProfitTarget("Long 1c", CalculationMode.Currency, PTarget3);
    SetProfitTarget("Long 1d", CalculationMode.Currency, PTarget4);
    SetProfitTarget("Long 1e", CalculationMode.Currency, PTarget5);
    SetProfitTarget("Short1a", CalculationMode.Currency, PTarget1);
    SetProfitTarget("Short 1b", CalculationMode.Currency, PTarget2);
    SetProfitTarget("Short1c", CalculationMode.Currency, PTarget3);
    SetProfitTarget("Short1d", CalculationMode.Currency, PTarget4);
    SetProfitTarget("Short1e", CalculationMode.Currency, PTarget5);
    SetTrailStop(CalculationMode.Ticks,TStop);


    some long or short condition;

    EnterLong(Convert.ToInt32(DefaultQuantity), "Long1a");
    EnterLong(Convert.ToInt32(DefaultQuantity), "Long1b");
    EnterLong(Convert.ToInt32(DefaultQuantity), "Long1c");
    EnterLong(Convert.ToInt32(DefaultQuantity), "Long1d");

    Glen
    Attached Files

    #2
    Hello demarcog, thanks for writing in.

    First, make sure your Entries Per Direction is set to at least 4 to enter 4 separate times. Next, go to your account, right click the account you are using this strategy on>select Edit Account. Make sure the Maximum Position Size is at least 4 as well. The margin error means there is not enough cash in the Sim account, you can edit that within the account Edit menu, then click "Reset" in the bottom right corner.

    Best regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi, ChrisL

      Thanks for the response. I set those a few days back and still having the problem.

      Entries per direction is 5, max positions in SIM101 is 100, and 1,000,000 is the cash in the account.
      Attached Files

      Comment


        #4
        Hi demarcog, thanks for your reply.

        Did you press "Reset account" after making the changes? This is the only way to apply the new cash value to the account. The margin error would not show up unless there is not enough cash in the account.

        Best regards,
        ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          ChrilL,

          Are you saying the values would be kept there across Ninja Restarts but it's possible that reset wasn't hit?

          Wow, never would of thought possible, but it's done and thank you I hope it works and I will know real soon/

          Unfortunately now I have to reload every strategy with the various parameters.

          glen

          Comment


            #6
            Hi ChrisL,

            thanks again, it didn't fix the one of the problems in the previous error message?

            glen

            Attached Files

            Comment


              #7
              ChrisL,

              Then there are these,( first 2 pages attached ) and NT comes hangs doesn't respond the only reply is end the program, and I've got no NT with 5 position up.

              Guess I won't be doing another SIM trade test during market hours. Which means no SIM at all as the market is always open and what is the point of sSIM.

              What I don't really understand is these are such basic functions of the product, setprofittarget and settrainligstop?

              Can you please have someone work on this as it is beyond discouraging and damaging to my account.

              thank you

              glen
              Attached Files

              Comment


                #8
                ChrisL,

                Here is another error that pops up, telling me the strategy isn't srarted where then are 7 instances of the strategy running.
                Attached Files

                Comment


                  #9
                  Hi Glen, thanks for your reply.

                  Please make sure you are running the latest version of NinjaTrader by running the installer below:

                  NinjaTrader is a futures trading platform that delivers integrated multi-device trading. Discover our best platform to trade futures for active futures traders.


                  After you have installed the latest version, reset your database completely:
                  • Shutdown NinjaTrader and Go to the Start Menu
                  • Select My Documents--> NinjaTrader 8--> db--> "NinjaTrader.sdf" file (may only say 'NinjaTrader' depending on your Windows File Explorer settings)
                  • Right click on NinjaTrader.sdf and select "Rename" *Name it "OLDNinjaTrader.sdf"
                  • Then restart the software and NinjaTrader will create a fresh database file to use
                  Please test your strategy again after completing this.

                  Best regards,
                  -ChrisL
                  Chris L.NinjaTrader Customer Service

                  Comment


                    #10
                    Chrisl,

                    I reinstalled the latest release over the weekend it went in fine.

                    Attached Files

                    Comment


                      #11
                      Hi ChrisL,

                      Just checking in to see if there was any progress on the problem and if there is any further documentation you need from me?

                      Another observation question, you have the basic order placement logic, I noticed it's generating exactly double the number of limit orders that I would expect.

                      I would expect 5 and I'm getting 10 limit orders

                      Is there any alternative way you can suggest that you know works, that you or anyone has that successfully simply scales out of a multiple position order?

                      Thank you,

                      glen

                      Comment


                        #12
                        ChrisL,

                        Just thought of something. You may want to check to see if this could be related to the number of strategies running.

                        Is it like charting, in that the limitation is in the form of NT slowing down after a certain number are open.

                        thank you

                        glen

                        Comment


                          #13
                          Hi Glen, thanks for your reply.

                          I did not get a confirmation that you have reset your database file. Please make sure you have completed this step. We have no other users writing in with this error.

                          We have an example here that demonstrates scaling out of a position:
                          https://ninjatrader.com/support/help...a_position.htm

                          Best regards,
                          -ChrisL
                          Chris L.NinjaTrader Customer Service

                          Comment


                            #14
                            ChrisL,

                            When you said reinstall I missed the part about resetting the database, apologies. Would that be a normal part of the reinstallation?

                            Comment


                              #15
                              ChrisL


                              I am still having the problem and would appreciate your help.




                              Glen
                              Attached Files
                              Last edited by demarcog; 05-11-2021, 09:01 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              31 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Waxavi, Today, 02:00 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by gentlebenthebear, Today, 01:30 AM
                              3 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X