What Is the FIFO Setting in Stocks? Here Is How It Differs From Weighted Average

A client recently asked us: "What is the FIFO setting? My broker platform account currently shows weighted average for my shareholdings." It is a great question, because many investors see the terms FIFO or weighted average in their broker platform without knowing what they mean - or whether they affect profit and loss.
In this article, we break down both methods one by one - with real worked examples - so you understand why the average price in your portfolio is displayed the way it is, and why that number sometimes looks "different" from your own calculation.
Quick Answer
FIFO (First In, First Out) and weighted average are two different methods brokers use to calculate the average price of your shareholdings. FIFO assumes the shares you bought first are sold first, while weighted average combines all your purchase costs and divides them by the total units held. Both settings only change how the average price is displayed in your portfolio - they do not change your actual profit or loss, because real profit and loss is calculated from the actual prices in your contract notes.
What Is FIFO (First In, First Out)?
FIFO stands for First In, First Out. The concept originates from inventory accounting: the earliest stock to enter the warehouse is assumed to be the first sold. According to Investopedia, FIFO is one of the most widely used asset cost valuation methods in the world because it follows the natural flow of goods.
In a stock context, FIFO means: when you sell part of your holdings, the broker's system assumes the units you sold are the ones you bought earliest. Your remaining holdings consist of the later purchase lots, and the displayed average price follows the cost of those remaining lots.
FIFO Worked Example
Say you make the following transactions for Stock ABC:
- 7 September: Buy 20,000 units at RM0.45 (cost RM9,000)
- 8 September: Buy 10,000 units at RM0.50 (cost RM5,000)
- 15 September: Sell 25,000 units at RM0.55
Under FIFO, the 25,000 units sold are treated as:
- 20,000 units from the first purchase (cost RM0.45)
- 5,000 units from the second purchase (cost RM0.50)
The remaining 5,000 units in your portfolio all come from the second purchase. So after this sale, your portfolio displays an average price of RM0.50 - no longer the blended average of both purchases. This is what often confuses investors: "I did not buy anything, so why did my average price go up?"
What Is Weighted Average?
Weighted average combines all your purchase costs and divides them by the total units held. The basic formula is simple:
Average price = Total purchase cost / Total units held
Weighted Average Worked Example
Using the same transaction data:
- Total cost: RM9,000 + RM5,000 = RM14,000
- Total units: 30,000
- Average price: RM14,000 / 30,000 = RM0.467
When you sell 25,000 units, the remaining 5,000 units stay displayed at an average price of RM0.467. That is because under the weighted average system, the average price is only recalculated when there is a new purchase - a partial sale does not change the displayed average price.

Same Data, Two Different Displays
Here is the effect of both methods on the same example after you sell 25,000 units at RM0.55:
| Item | FIFO | Weighted Average |
|---|---|---|
| Displayed average price after partial sale | RM0.50 (follows remaining lots) | RM0.467 (unchanged) |
| Cost of remaining 5,000 units | RM2,500 | RM2,333 |
| Realised profit on selling 25,000 units | RM2,250 | RM2,083 |
| Total profit once all units are sold | Same | Same |
Notice that the realised profit looks different (RM2,250 vs RM2,083), but this is just how profit is split between realised and unrealised. Your total cost is RM14,000 under both methods, and once you sell all remaining units, the total profit is identical. Not a single sen of your money is gained or lost because of this setting.
Where Do These Methods Come From?
FIFO and weighted average are actually inventory valuation methods from accounting. There is also LIFO (Last In, First Out) - last in, first out. However, LIFO is not permitted under International Financial Reporting Standards (IFRS), which Malaysia follows, so you rarely see that term in local broker platforms.
Stockbrokers borrow these concepts for one purpose: to display a single reference number representing the cost of your holdings. Each broker is free to choose the method they believe is clearest for their clients.
Why Does Your Broker Platform Show Weighted Average?
If you are an M+ Online user, here is the history: before 5 December 2020, M+ used the FIFO system for average price calculation in the portfolio view. According to iSaham, starting 5 December 2020, M+ switched to the Weighted Average Price (WAP) system because FIFO caused confusion - every time an investor sold part of their holdings, the displayed average price suddenly changed even though they had not bought anything.
With weighted average, the display is more stable and easier to understand: the average price only changes when you add a new purchase. That is why your account today shows "weighted average" for your shareholdings.
Not every broker uses the same method. Some brokers in other countries, such as ICICI Direct in India, still use the FIFO method for their portfolio display. So if you use more than one platform, do not be surprised if the average price for the same counter looks different between platforms.
Does This Setting Change Your Actual Profit or Loss?
No. This is the most important point in this entire article.
Your actual profit or loss is calculated from the real purchase and sale prices recorded in your contract notes. Whether your broker displays FIFO or weighted average, the money you paid and received does not change by a single sen.
The average price shown in your portfolio is only a quick reference for assessing your current position. For accurate records, always refer to your contract notes. We explain how average price works in more depth in Average Price in Stocks: How to Calculate, Average Up & Average Down.
FIFO in Other Contexts: Intraday & Tax
FIFO and intraday trading
The term FIFO also appears in intraday trading on Bursa Malaysia. If you buy and sell the same counter on the same day, the broker's system matches the sale against the earliest purchase of the day (first in, first out) for contra calculation. This also affects how brokerage charges are computed - we cover it in Beza Kos Intraday & Swing.
FIFO and tax
In countries like the United States, the choice of cost basis method (FIFO, specific identification and so on) matters a great deal because it determines how much capital gains tax investors there must pay. In Malaysia, things are far simpler: capital gains made by individuals from selling shares listed on Bursa Malaysia are not taxed. According to EY Malaysia, the capital gains tax (CGT) regime introduced in 2024 only applies to companies disposing of unlisted shares - individuals trading shares on Bursa are unaffected.
Investors still face other transaction costs such as stamp duty and brokerage fees on every trade - see our breakdown in Stock Investor Tax Malaysia: Dividend, CGT & Stamp Duty.
Can You Switch Between FIFO and Weighted Average?
For most local brokers, including M+ Online, the average price calculation method is fixed by the system - you cannot switch between FIFO and weighted average yourself. The 2020 change from FIFO to weighted average was made at platform level for all users at once.
For foreign stock platforms, some US brokers let you choose a cost basis method for tax reporting purposes in their country. If you invest in US stocks through M+ Global, the transaction cost structure differs from Bursa - see Kos Jual Beli Saham Di M+ Global for details.
Tips: How to Track Your Real Cost
- Keep every contract note - this is the official record of your cost, not the portfolio display.
- Maintain your own spreadsheet - record the date, units, price and charges for every transaction.
- Never sell based solely on the displayed average price - it is a reference, not a final figure.
- Understand realised vs unrealised profit - especially after partial sales.
- If you use averaging techniques, make sure the company fundamentals are solid - we explain the risks in Average Price in Stocks.
Frequently Asked Questions (FAQ)
What does FIFO mean in stocks?
FIFO (First In, First Out) means the shares you bought earliest are treated as sold first when you make a partial sale. It affects how the average price of your remaining holdings is displayed.
What is weighted average price in a stock portfolio?
Weighted average price is the total cost of all purchases divided by the total units held. The average price only changes when you make a new purchase - partial sales do not change it.
Why did my average price not change after I sold half my holdings?
Because your platform uses the weighted average method. Under this method, the average price is only recalculated after a new purchase, not after a sale.
Does FIFO or weighted average affect my profit and loss?
No. Actual profit and loss is calculated from the real prices in your contract notes. Both methods only change how the average price is displayed in your portfolio.
Why does M+ Online use weighted average now?
M+ switched from FIFO to Weighted Average Price on 5 December 2020 to avoid confusion, because under FIFO the average price changed every time an investor made a partial sale.
Can I change my setting from weighted average to FIFO?
For local brokers like M+ Online, no - the method is set at platform level for all users. Some foreign brokers allow you to choose a cost basis method for tax purposes in their country.
Is profit from selling shares taxed in Malaysia?
For individuals, capital gains from selling shares listed on Bursa Malaysia are not taxed. The 2024 CGT only applies to companies disposing of unlisted shares.
How do I find the real cost of my shares?
Refer to the contract note for every transaction. Add up all purchase costs including brokerage and stamp duty, then divide by total units to get your true average cost.
Conclusion
FIFO and weighted average are simply two different ways of displaying the average price of your shareholdings - FIFO follows purchase lot order, weighted average blends all costs into one number. Your platform shows weighted average because that is the method M+ Online has used since December 2020, and most importantly: this setting does not change your actual profit or loss at all.
Now that you understand how brokers calculate your average holding price, the next step is putting it into practice with your own account.
If you do not have an account yet, open a CDS account to start investing in Bursa Malaysia as well as foreign markets like the US and Hong Kong.
To learn stock market basics in a structured way, download our free Stock Market Basics Ebook.