I have encountered a few issues when using backtesting, which can affect the backtests in a huge way. I am not able to recall the few issues i have found, so I am mentioning one below which i just encountered.
I will use this thread to post about any other issue that might cause a huge difference to backtest results.
I have created a simple strategy to enter into a short trade if the prev close of a 15 min candle crosses below the Supertrend (144,3)
I am using this on the GBPINR March Future script. As per the charts on kite, there is no sell signal from the supertrend on 27th Feb, 2019.
But, the transactions list shown in the backtest points out that there was an entry taken on the same date.
I have provided the screenshots below,
Streak backtesting transaction:
Kite 15 min chart:
Could you please look into this. Please let me know if there is any issue on my end or if i have missed something.
I will update this when i am able to recall any other potential issues.
There is nothing particularly wrong with the backtest results. In your entry condition you have specified ‘Previous close crosses below Supertrend’ hence it will compare the close of previous 15 min candle with the current [Candle (0)] value of supertrend.
If we look at the charts, we can easily see that the close of 16:45 candle of 26th feb crossed below supertrend value of 9:00 A.M 27th feb candle.
@Renko_Jhunjunwala Okay, wow. I didn’t see it that way, so thank you.
Good to know that is how it works.
@Streak But ideally, I don’t think there would be much of use to compare a previous Nth candle close with current supertrend value. I really think it should be compared with that corresponding candle’s supertrend value, if it’s possible. Anyways, thank you.
I am tracking this thread and I look forward to the remedy, for my own learning.
Offset for supertrend indicator is needed to form this condition. We are glad to inform you that offsets for about 10 indicators are scheduled to be released this week including supertrend!
Nice! You guys are doing a wonderful job. Keep going the same way.
Will update this thread when i find any more issues or just things that might help improve our experience.
Below is a few other issues I encountered today. I will put this here, please let me know if i have missed anything on my end.
My Strategy/Duration/Script used for Backtesting:
Kite chart for the concerned duration:
Transactions in the backtest results:
Now, i have noticed the below two issues with this:
The entry signal shown on 5-Feb-2019 is not included in the transactions of the backtest. I am not sure why this could be. It is highlighted as A in the chart
The entry as per the chart on 7-Feb-2019 must have been at 9:15 AM i.e. at point B1 at the price around 82.18.
But, the actual entry is taken on 7-Feb-2019 at 2:45 PM, i.e. at point B2 at a price of 81.77 when actually there was no signal as per the chart.
This could cause a huge difference in P/L in the backtests.
Could you please clarify on these 2 points?
Okay, thank you very much for the detailed explanation.
But, is there any way this can be rectified?
i.e. during backtesting also, can the calculations and signals be made precise by using enough/abundance of candles as necessary (just like when it is deployed)
Because, the backtesting results might vary by a huge margin because of these inaccurate trade calculations.
So, based on this backtesting we might actually think the strategy is good and deploy it. When actually, the strategy might not be that good.
So we are looking into ways for doing this dynamically for backtesting, that’s why by default we have enabled 3months for backtesting in intraday so mostly no one face’s this.
Now as your period is huge, you should try to backtest for as long duration as possible and then just ignore the first trade, the pnl only for the first trade can discounted for and the rest remains the same.
Okay, thank you very much for the explanation and the workaround suggested for now.
Will try this when backtesting again and update the thread if any other clarifications needed.
Thank you for the workaround, this helps now. Hope this can be fixed in the coming days.
Also as a suggestion, could it be made possible to download the backtest data for all scripts at once, instead of having to download for each script separately.
- maybe it can all be downloaded in one excel workbook, with a separate worksheet for each script
- or zip all worksheets and downloadable at once
I have attached screenshot below, for what i am referring to.
Any update on this? Will the offsets work as expected now?
Also, can this be made possible?
Hi @Streak ,
Here is another very important issue that needs to be rectified at the earliest.
This is mainly when testing CNC orders because of the gap ups and gap downs.
Let’s say if i enter long into a trade place a SL exit at 0.2% on a stock, and it opens say 1% gap down,
then the exit price should be the current price at when exit is triggered.
But, currently it just takes 0.2% value of the price as exit value, even though that price has not been hit.
This is a major issue and influences the backtest results in a very wrong way. Below is a few screenshots to help.
Transaction on Streak:
Also, could you please respond to the earlier suggestions?
We would request to backtest this again, this edge is now being accounted in the backtests.
This has been released few week back, you should be able to see it as one of the parameter options.
This is yet to be released, we will keep you posted.
Great work @Streak and thank you very much.
I checked the issues that i have mentioned earlier in this post and its resolved.
Saves me even more time now.
Will update if i find anything else or if any feedback.
I have created backtesting with Ema above 20.
Streak is giving false signal entry’s
Please share the strategy link for the strategy that you have created and also mention the date and time of the false signal that was generated. I will check and assist you further. Refer to the link to learn how to share the strategy link - How to share a backtested strategy - Streak Tech