there is no way the IRS will allow people to avoid paying taxes using this trick.
if this really catches up i am sure they will clarify that the determining exchange rate for tax purposes is the median of all inputs or something of that sort.
There is no trick involved. Quite the opposite, that method is using precision to achieve the most desirable ends.
Let's say I bought two plots of land, one in 2011 and one in early 2014. A family emergency comes up and I need some extra cash. I can choose to sell whichever plot of land I want, and I'm obviously going to choose to sell the one which results in the most favorable tax outcome for me at that point in time. There is nothing wrong with this kind of thing.
"Any one may so arrange his affairs that his taxes shall be as low as possible; he is not bound to choose that pattern which will best pay the Treasury; there is not even a patriotic duty to increase one's taxes." - Learned Hand. (Helvering v. Gregory, 69 F.2d 809, 810-11 (2d Cir. 1934).)