Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing my Tradesize int

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

    Changing my Tradesize int

    Hi ,

    I am wanting to change my trade size on some trades and am using a bool set to false. Hasve searched the forum but still unsure why it wont change as shown.

    Tradesize =20000 for the entry.

    thanks Raef



    // Condition set 1
    if (SecondEntry == true)
    {
    Tradesize =
    20000; // problem here
    }
    if (CrossAbove(EMA(Fema), EMA(Sema), 1))
    {
    EnterLong(Tradesize,
    "");
    }

    #2
    Originally posted by raefon72 View Post
    Hi ,

    I am wanting to change my trade size on some trades and am using a bool set to false. Hasve searched the forum but still unsure why it wont change as shown.

    Tradesize =20000 for the entry.

    thanks Raef



    // Condition set 1
    if (SecondEntry == true)
    {
    Tradesize =
    20000; // problem here
    }
    if (CrossAbove(EMA(Fema), EMA(Sema), 1))
    {
    EnterLong(Tradesize,
    "");
    }
    What is the error message?

    Comment


      #3
      raefon,

      If you could post more of your code it would be helpful. I don't see anything immediately wrong with this.

      I look forward to assisting you.
      Adam P.NinjaTrader Customer Service

      Comment


        #4
        This forum has me limited to 10000 and wont let me post the whole script so attached as zip file


        raef


        privatebool secondEntry = false; // Default setting for SecondEntry
        privateint tradesize = 10000; // Default setting for Tradesize
        // User defined variables (add any user defined variables below)
        #endregion

        [Description("")]
        [GridCategory(
        "Parameters")]
        publicbool SecondEntry
        {
        get { return secondEntry; }
        set { secondEntry = value; }
        }
        [Description(
        "")]
        [GridCategory(
        "Parameters")]
        publicint Tradesize
        {
        get { return tradesize; }
        set { tradesize = Math.Max(10000, value); }
        }
        #endregion
        Attached Files

        Comment


          #5
          raefon,

          You aren't setting the SecondEntry property to true so it won't ever change the order quantity.

          Please let me know if I may assist further.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Is he using it as a parameter?


            Originally posted by NinjaTrader_AdamP View Post
            raefon,

            You aren't setting the SecondEntry property to true so it won't ever change the order quantity.

            Please let me know if I may assist further.

            Comment


              #7
              sledge,

              He has "SecondEntry" setup as a user defined input but it is never changing. My impression was he wants to increase his order size after something occurs. Since nothing is setting the parameter "SecondEntry" the order quantity never changes. It will always either be 10000 or 20000 depending on what he sets the "SecondEntry" to initially.

              Please let me know if I may assist further.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Hi Adam,

                I am not sure what you mean.
                privatebool secondEntry = false; // Default setting for SecondEntry

                Its a bool at the begining of the script and can be set to true in the variables but it's default is false.

                // Condition set 1
                if (SecondEntry == true)
                {
                Tradesize =
                20000;
                }
                if (CrossAbove(EMA(Fema), EMA(Sema), 1))
                {
                EnterLong(Tradesize,
                "");
                }
                Last edited by raefon72; 01-02-2012, 04:15 PM.

                Comment


                  #9
                  if (SecondEntry == true)
                  is a test of the SecondEntry.

                  Where in your code have you set SecondEntry to true, based on some condition or other? If you have not explicitly set SecondEntry to true somewhere in the code, then it has its default value, which is false, so your test condition above will never trigger.

                  Comment


                    #10
                    At the parameter settings I can select true or false. The strategy works as false and works as true but doesn't change my entry size. It seems to ignore the statement.

                    Comment


                      #11
                      Originally posted by raefon72 View Post
                      At the parameter settings I can select true or false. The strategy works as false and works as true but doesn't change my entry size. It seems to ignore the statement.
                      OK - that's what I thought you were doing.

                      It isn't being accepted as a parameter for whatever reason.

                      I have not dealt with these as I don't use parameters, but please try this instead:


                      privatebool secondEntry ; // Default setting for SecondEntry

                      Comment


                        #12
                        Thanks guys,

                        There must be somthing else wrong however i have copied the code and put it into a strategy and it seems to work ok on another strategy. There might be somthing missing on this one.

                        One job down and only a few to go.

                        Thanks again.

                        Comment


                          #13
                          Sometimes, restarting NT clears up a lot of these odd items that work elsewhere.

                          Good luck!



                          Originally posted by raefon72 View Post
                          Thanks guys,

                          There must be somthing else wrong however i have copied the code and put it into a strategy and it seems to work ok on another strategy. There might be somthing missing on this one.

                          One job down and only a few to go.

                          Thanks again.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          648 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          369 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          108 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          572 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          573 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X