Why does it show MTM loss when i re-enter a future trade even after square off (intraday)?

I asked this question at traderji.com with no good answers, hence trying my luck here.
Dear Friends,

What i observed have created a fear for re-entering a future position of same stock even after square-off.

This is what i saw:

I purchased futures of ABC company at price suppose: 200/-
Price rose to 250/- and yet to square off, when it shows me MTM profit as 50/-

I square off and get a nice 50 bucks profit.

Case 1:
Now starts the drama !!!
The price fell to 100/- and starts rising from there.
I re-purchase the shares at 100/- but here it shows me, i have a MTM loss of around 150 Rs !!! As the shares value now starts increasing from 100/- my loss reduces.

I am utterly confused. I did squared off in the first transaction, then why does the system compare with the earlier price??

Case 2: I go long on a future trade when price was at 100/- price rose to 120/-, when it shows i have a MTM profit of 20Rs. I square off and get 20Rs profit. Now suppose the future price starts dropping from 120/- and i go short on the same future (in which i was long earlier), it shows me a MTM loss, as the price reduces. Now, suppose the price drops to 90/- My MTM profit becomes 30/- I square off and get a booked loss of Rs 10 in booked P/L!!! Why does it show, when i square-off the first position?

Pardon me, if i missing something, and again beg an apology in advance. But please help me to understand this !!

The problem also happens, if i go once short at a future, and later go long on it after sometime (of course the previous one was squared off).

Thank You once again.
EDIT:
Additionally the quantities purchased before and after are added as well. Also, my experience about this is only from intraday perspective.

High taxes and brokerage

Taxes and brokerages are added at the day end when contract note is sent, not at the time of trading.