Calculating Returns for Short Strategy

Course Name: Candlestick Patterns based Automated Trading, Section No: 17, Unit No: 4, Unit type: Notebook

https://i.imgur.com/7FfXc0L.png

Hello, in this part of the code should we assing -1 to those places where we're shorting due to bearish candle patterns? Because later we calculate strategy returns as data.trade_signal.shift(1) * data.Close.pct_change(), so if one day the instrument get a negative return, if we are short the return will be positive.

Please see the following explanation for what I'm saying:



Hi Daniel,



A signal of 1 indicates a long position and -1 indicates a short position.



While trading when we anticipate an increase in price, we take a long position. On the other hand, when we anticipate a decrease in price, we take a short position.



Therefore, if the daily change in price is positive then:

  • A long position would yield positive returns
  • A short position would yield negative returns



    On the other hand, if the daily change in price is negative then:
  • A long position would yield negative returns
  • A short position would yield positive returns



    In the image that you have shared: the returns are negative, which is why a short position (-1) is yielding positive returns. If we had taken a long position (1) then the returns would be negative. 



    Hope this helps!



    Thanks

    Rushda

     

Please, check again my question: in this notebook you're opening longs/shorts depending the candle pattern you have. However when generating the trading signals you're only placing 1 when a pattern is detected, no matter if the pattern is bullish or bearish it always has a 1 in the "trading_signal" causing when we're short and the market moves down in our favour (negative return), in the backtest the result is negative against us because of this.



In the last image I've share I'm showing you what I consider the proper way to generate both, long and short signals, and obtaining a proper "strategy_returns" column.

Hi Daniel,



We are checking this and will get back to you.

Okay, please keep me updated.

Hello, any new about this question?

Hi Daniel,



The notebook has been updated.

Thanks!