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

Position sizing

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

    Position sizing

    Hello,


    I have excellent debugging AOS, but I have several questions related to position sizing and their application in Script. I would appreciate if someone helps me.
    Q1. Calculation of Kelly and Lead Risk is realized through a double variable.
    The result is the size of the position of "double", and is rounded to an integer. Open position requires variable "int".

    EnterLong (int, "BuyLong1");

    And here is precisely the problem as I add value to double = int because EnterLong function does not work with double variable?

    Q2. For my calculations, position sizing using the function

    "Performance.AllTrades .....", for back-testing.

    I think the real trading will be used function Performance.RealtimeTrades. Is this correct?

    Q3. Is it possible to change the quantity of contracts, or some setting strategy when this strategy is running? I am asking is because the demo does not allow me to change settings.


    and finally

    Q4. If the strategy is running, and I have to restart your computer or platform, I re-start the strategy. Will my business strategy to know what was taken? "Performance.RealtimeTrades"

    Apologies for my English.

    Thank you for your reply Rasto

    #2
    Q1: Use Math.Round()

    Comment


      #3
      Sorry, Aslan thanks for the recommendation but Math.round returns only "double" and not for the "int". This is not a solution

      Comment


        #4
        double size = ....
        int contracts = (int)Math.Round(size);

        Comment


          #5
          Aslan, thank you very much, you genius's really helped me

          Comment


            #6
            Can somebody answer to other questions, thank you much if so?

            Comment


              #7
              Hello,

              This link should answer most of your question. Let me know if you still have more questions:

              And this link:
              DenNinjaTrader Customer Service

              Comment


                #8
                Originally posted by rastotrader View Post
                Can somebody answer to other questions, thank you much if so?
                Maybe this can help a little http://www.ninjatrader-support2.com/...=position+size

                Comment


                  #9
                  Josh and PrTester thank you for your reply.
                  PrTester I have code very similar to PS, but your code so I brought a different look. Even on my last question:
                  They know my strategy in realtime trading when it restarts, which carried realtime business before?

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by funk10101, Today, 12:02 AM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_LuisH  
                  Started by GLFX005, Today, 03:23 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by nandhumca, Yesterday, 03:41 PM
                  1 response
                  13 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by The_Sec, Yesterday, 03:37 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by vecnopus, Today, 06:15 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post vecnopus  
                  Working...
                  X