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

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
    Chris L.NinjaTrader Customer Service

    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
        Chris L.NinjaTrader Customer Service

        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
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thank you for the help

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cre8able, Yesterday, 01:16 PM
              3 responses
              11 views
              0 likes
              Last Post cre8able  
              Started by ChartTourist, Today, 08:22 AM
              0 responses
              6 views
              0 likes
              Last Post ChartTourist  
              Started by LiamTwine, Today, 08:10 AM
              0 responses
              2 views
              0 likes
              Last Post LiamTwine  
              Started by Balage0922, Today, 07:38 AM
              0 responses
              5 views
              0 likes
              Last Post Balage0922  
              Started by JoMoon2024, Today, 06:56 AM
              0 responses
              6 views
              0 likes
              Last Post JoMoon2024  
              Working...
              X