Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

calculate entry position size

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

    calculate entry position size

    Hi, Need with help to calculate entry position size.
    Variables:
    Start of day net account balance : $5000
    Current Stock price : $120
    Allocation: 15%
    Qty : Start of Day account balance * Allocation / Current stock price (5000*15%/120 = 6.25) so need a return value of 6

    is there a command which returns {Start of day net account balance}, {which converts 6.25 to 6 for the qty} & i believe i can use close[0] for the stock price


    thanks for your help

    #2
    Hello cbsplanet,

    There wouldn't be anything built in for that, you could make a User input for that purpose. If the start of day balance is a default value which should be the same for each day then a double user input would be best for that. If you are trying to track the realized PnL from the previous day as a starting point you could see the following example which shows how to track realized PnL and reset for each session.



    Comment


      #3
      thank you Jesse for the reply. I am actually trying to customize a strategy where the order position is auto calculated based on the account net balance. So if at start of the day if my account net balance is 5000 on day 1 then i can buy X stock and day 2 the account balance is 5200 then it take a position based on new balance.

      Comment


        #4
        Hello cbsplanet,

        Did you have additional questions or were you just clarifying the goal?

        If we loop back to the original question, there is not a command for what you are asking. If you still had questions, what part did you need help with for the calculation?

        Comment


          #5
          Hi Jesse, it was a question but i have a solution. used below calculation to get the cashvalue .

          cashValue = account.Get(AccountItem.CashValue, Currency.UsDollar);


          this allows me to select a account gets it cashvalue and allocate a % of the cashvalue in strategy to buy and sell.

          tx for the help

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          90 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          137 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          68 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          120 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          71 views
          0 likes
          Last Post PaulMohn  
          Working...
          X