Reversing Trades Didn't Reverse Profits

Hi all,

I have been using the last few days creating a strategy, and I noticed something very odd.

Using the strategy on an FX pair from 2010 to now, I got -37% return. So I thought, why not just reverse it with SELL when it was BUY and BUY when I had sell. Then I should have made +37%, right?

But when reversing, it suddenly got -77%! Really not sure why this is happening?!

Also seems like the algo is overtrading. One element is trade when 13 EMA cross 21 EMA. But it trades even when its not crossing and I have checked with many price providers and charts...  I don't understand whats happening, can someone explain it to me?

Update Backtest

Without seeing the code, I would say because you're holding different assets at different times with the logic swapped, so your logic applies differently. For example, let's assume your algo buys a stock when the 13 EMA crosses below above 21 EMA, and sell it on some other criteria. If you swap to buy on some other criteria and sell on the EMA cross, then you will buy entirely different assets or at completely different times because your criteria is different.

So it's not really a "mirror image". Even if your algo were to turn a profit with the reversal, it would still be a random effect, and not some sort of reversal of the logic.


thanks! After looking at it, it does make sense and definitely not as simple as just "swap" buy and sell and mirror the results.




Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed