Course Name: Day Trading Strategies for Beginners, Section No: 9, Unit No: 1, Unit type: Document
Hi,
this question is about course Day Trading Strategies for Beginners.
I tried gap_up_down_strategy on blueshift for AMZN for 2019. And then same is illustrated in jupyter note book given in section 6.16. Results from blueshift is entirely different from jupyter note book in course. Wanted to know if i am missing something here.
from jupyter notebook: 20%
from blueshift: -40%
Regards,
Amit
Hi Amit,
I tested code from both notebooks and in blueshift side by side. I found out that the Standard deviation threshold in notebooks and blueshift strategy is not the same. It's 0.25 in the notebook and 2 in the blueshift strategy. this could be one reason for this difference in returns. The other reason for the difference in returns could be there in the notebook we are calculating standard deviation for 90 days but in the blueshift strategy, we are calculating it for 252 days (i.e. all the trading days in a year). I ran the blueshift strategy on the same time period used in the notebook (i.e. 14 Jan 2019 - 30 Aug 2019) and on the same parameters used in the notebook, and I got similar returns.
The reason why we sometimes use different parameters for the blueshift strategy is that we generally run them on different time periods. So we try to find the parameters that work best in different time periods.
Hi Danish,
Thank you for your reply.
I tried again by setting std_dev_threshold=0.25 and trading days for std deviation calculation as 90. But I am still getting -12% return.
i just clicked on the template given in the course and retested on AMZN.
Regards,
Amit
Hi Amit,
The reason for this difference in returns between notebook and the blueshift strategy is that the blueshift uses different order fill logic. Blueshift only fills the quantity which is less than 1% of the volume traded. Therefore, the price at which the order fills in Blueshift might be different then what we have considered in the notebook. Another reason why the results are different is that, the data range considered in the notebook might be different then used in Blueshift. Also, blueshift returns are after all slippages and commissions are assumed. So for these reasons, returns in a notebook and the blueshift will never match. In other words, I can say that the strategies backtested in blueshift work similar to how they would work in real-world scenarios. That is why we use different parameters and different assets in our blueshift strategy.
You can go to Section 8, Unit 6 of the Day Trading Strategies for Beginners course where the same thing is explained in a video lecture. I hope this was helpful.
Hi Amit,
We had a closer look at the blueshift strategy and we found out that the entry logic in the blueshift strategy was inconsistent with the notebook. The notebook strategy generates the signal based on one day lagged open price and the blueshift strategy was not following the same logic. Thanks for pointing out this error in our code. You will be able to see the updated blueshift strategy shortly.
If you want to backtest the blue shift strategy without slippages and commissions you can use this code below.
set_commission(commission.PerShare(cost=0.0, min_trade_cost=0.0))
set_slippage(slippage.FixedSlippage(0.00))
You can paste this code in initialize() function below the schedule_function.
Hope this helps.