Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Variable EnterLong Position Quantity

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

    Variable EnterLong Position Quantity

    Hi

    I'd like to EnterLong a

    double amount = $10000/Close[0];

    so it will differs every time by the Close[0] price.

    Problem is that ninjatrader format:

    EnterLong[int quantity, string signalname]

    doesn´t allow a "double" value on quantity

    Any idea ?

    Thanks in advance.

    #2
    So I can give you a proper response.

    Is $10000/Close[0] worth a dollar amount you want to buy, or an amount of shares/lots
    LanceNinjaTrader Customer Service

    Comment


      #3
      amount shares please

      Comment


        #4
        In this case you'll want to convert your double value to an int

        Convert.ToInt32(yourDouble)



        Depending on how you want to handle the conversion you may want to also first round the double.
        Example: Math.Round http://msdn.microsoft.com/en-us/libr...ath.round.aspx
        LanceNinjaTrader Customer Service

        Comment


          #5
          Adjusting postion size

          if(DailyATR(5)[0] <150);
          {voldivide = 1;}

          if(DailyATR(5)[0] >=150);
          {voldivide = 2;}


          this code works but doesnt give me the option to make small changes to position size. I would like to use voldivide values or 1,4 1,3 etc... Is there any way to adjust the number of lots traded not using int values?




          Regards and thx

          Comment


            #6
            everington_f, what instrument do you trade? A quantity of 1 would be the smallest you could trade. Even if trading Forex for example, then just enter the full unit amount - i.e. 10000 for a minilot, or 0.01M

            Comment


              #7
              I have solved the problem with a couple of Doubles and a double-int conversion. Thanks for the response though Bertrand.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, Yesterday, 10:06 AM
              0 responses
              14 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              11 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              9 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              4 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              31 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X