What the result leaves out
Fees and commissions are not included. Add them to the price of a purchase to include them in the average.
Tax rules can use a different cost basis, such as first in, first out or specific lots, and wash-sale rules can change it. Lowering the average does not lower the risk of the position; it adds to it.