journalling partial adding and take profit orders

Discussion in 'Risk Management' started by Ivano, Feb 10, 2025.

  1. Ivano

    Ivano

    Would like to know the logic I should manage partial take profits, so I buy 50 msft then add after one month other 50 totalling 100 then I sell 30 because I think market will go down, then sell the remaining 70 after 3 months

    Imagine I have 10 trades as this one with apple, nvda, tsla
    Which is the best practice to write some logic I could apply to calculate my statistics for risk management in case of partial adding and take profits?
    An average win, an average loss, statistics for Kelly, and so on

    AI suggest me lifo fifo, but looks to me strange so I ask because some of you know the best practices.
     
  2. MarkBrown

    MarkBrown

    gpt 03-mini-high

    Best Practice Considerations
    • Maintain a Detailed Ledger:
      Store each entry and exit with its date, quantity, and price. This way, you have a complete history for each trade.

    • Weighted Average vs. FIFO/LIFO:
      Although FIFO (first in, first out) or LIFO (last in, first out) are common for tax accounting, for risk management (calculating average win, loss, etc.) the weighted average method tends to be more straightforward and reflective of your overall performance. It treats the trade as a single aggregated position with a continuously updated cost basis.

    • Partial Exits:
      Record partial exits as they occur. In your performance statistics, each trade’s net result is the sum of its partial exits. This net result becomes your data point for calculating metrics like average win/loss and the Kelly fraction.

    • Time Factor:
      If you are tracking trades over different time frames (like adding after one month and selling the remainder three months later), you may also wish to capture the holding period so you can analyze returns on an annualized basis or incorporate the time dimension into your risk metrics.
    Final Thoughts
    Using the weighted average cost basis with a robust trade ledger allows you to account for partial entries and exits cleanly. Once you have the net P&L for each trade, you can calculate your average win, average loss, win ratio, and even compute a Kelly fraction for position sizing. This approach is generally regarded as best practice for risk management when your entries and exits occur in multiple legs.
     
    Ivano likes this.
  3. Ivano

    Ivano

    make sense to find problems, I will show all the transactions in the UI for a stock

    Yes asking a better ai prompt was suggested weighted average

    The rest does not make too much sense, I understood have to write a difficult software, but looks easier than expected cause I am running every kind of test