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 NullPointStrategies, Today, 05:17 AM
          0 responses
          43 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          65 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