Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to calculate a position percentage size in the Builder

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

    How to calculate a position percentage size in the Builder

    Hello,

    I would like to know how can I set the position quantity of a strategy in the builder as the account is growing up or going down, this in a percentage of the account. In the condition Builder I can't set a math calculation to calculate the contract size which can be:
    // Calculate position size
    positionsize=round(accountvalue(iex:100000)*percen tage(iex:1.5%)/(stopsize*tickvalue),0);
    Do I need to unlock the code or how can I calculate the quantity?

    Thank you so much

    #2
    Hello jeremy83846,

    This would be a situation where unlocking the code would be needed. The math you would need for this would not be able to be done using the arithmetic builder. The actual account value also is not something you can access in the builder, you could define a user input for that to manually define an account size to use in the script but the other math would still be an issue.

    I look forward to being of further assistance.

    Comment


      #3
      OK, so if I need to use the code and I set the Realized PnL it is not recognized as the account size of that math formula?

      Comment


        #4
        Hello jeremy83846,

        I am not certain I understand the question how it was written, could you clarify what you are asking to do?

        I look forward to being of further assistance.

        Comment


          #5
          For example if I set on the code:

          EnterShort(Convert.ToInt32(SystemPerformance.AllTr ades.TradesPerformance.Currency.CumProfit*percen tage(iex:1.5%)/(stopsize*tickvalue), @"Corto");

          That formula should be honored?

          Comment


            #6
            Hello jeremy83846,

            Do you mean will that value be used for the short entry? If so yes.

            If you calculate a value before submitting the entry that would work to set a quantity. You could do the calculation directly in the method like you have shown or do it a line above that and make a variable that is really up to your coding style.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            45 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            21 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            31 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Working...
            X