Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add the quantity of contrats.

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

    How to add the quantity of contrats.

    Hello Guys.

    I have an issue, my strategy go LONG with 1 contracts and SHORT with 2 contracts. I just want 1 contract per side.

    Already add "Defaultquantity" in inputs and conditions but same issue.

    Thank you fot your time... i want to solve this soon

    #2
    Hi Kevin, thanks for posting.

    Please see the SampleMACrossover strategy as a good example strategy that only enters one contract per side. If you are unable to identify the issue in the strategy you are working with currently, you will need to reduce the strategy code down until the issue is recognized. Also, the best way to test a strategy is through the playback connection where you can identify a single section of data where your strategy reaches its entry signal and play back that section over and over for testing:


    Kind regards,
    -ChrisL

    Comment


      #3
      Thank You ChrisL

      Can you send me how can i add the quantity in inputs correctly? Maybe the issue is there

      Regards

      Comment


        #4
        Hi Kevin,

        You can add an int input to the strategy class like so:

        Code:
        [Range(1, int.MaxValue), NinjaScriptProperty]
        [Display(ResourceType = typeof(Custom.Resource), Name = "Quantity", GroupName = "NinjaScriptStrategyParameters", Order = 0)]
        public int Quant
        { get; set; }
        Then use it in an order entry method e.g.

        Code:
        EnterLong(Quant);
        Kind regards,
        -ChrisL

        Comment


          #5
          Is possible get step by step doing manualle in the builder box?

          I dont know can i add the "code"

          Thank you

          Comment


            #6
            Hi Kevin,

            We have documentation here on using the Inputs and Variables section of the builder:


            Heres an example of how you would use this "Quantity" integer:



            Kind regards,
            -ChrisL

            Comment


              #7
              Thank you for the help

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              50 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              68 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X