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 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