Login Page - Create Account

Support Board


Date/Time: Tue, 12 Nov 2024 22:18:28 +0000



[Programming Help] - Question: Backtesting

View Count: 1430

[2020-05-27 11:20:41]
rainbow47 - Posts: 68
Hi,

I have automated stratey which is based on the Spreadsheet Trading System. The strategy receibe buy/sell signals from alerts form the main chart + an alert from another chart. Both charts are Renko charts with different resolutions. I am receiving the alert condition from the second chart via Study/Price.

Initially I backtested the system for 90D via the AutoTrade System Replay Backtest (Accurate Trading System BackTest).

Aftwerwards I backtested again for 90D via the Chart Replay and All Charts with the same ink number selected (both charts have the same number). I also selected Accurate Trading System BackTest.

To my surprise the outcomes were very different. Now I wonder, what is the right way to backtest a system which receives an alert from a different chart?

Thanks
[2020-05-27 12:07:24]
Sawtooth - Posts: 4114
With overlaid Renko charts, you need to only use Chart >> Replay Chart:
Auto Trade System Back Testing: Replay Back Testing - Manual

Also, in the Study/Price Overlay study, be sure to set the 'Data Copy Mode' to 'Use Earliest Value from Corresponding Timeframe'.
Auto Trade System Back Testing: Performing Back Testing on a Trading System That Uses Multiple Charts
[2020-05-27 12:56:13]
rainbow47 - Posts: 68
Thank you tomgilb.

I changed the settings as you suggested for Study/Priced. Picture attached to make sure that all seetings are correct.

I did a AutoTrade System Replay Backtest and a Replay Chart:Charts with same Link number at Speed 960.

The results are still very different and I don't know which one I can rely on.

The settings for the Main Chart: Renko Bar with setting 12

The seeting for the secondary chart: Flex-Renko with setting 80-60-60.

Any advice which method produces reliable backtest results?
Date Time Of Last Edit: 2020-05-27 13:15:22
image1.JPG / V - Attached On 2020-05-27 13:15:20 UTC - Size: 110.37 KB - 250 views
[2020-05-27 13:16:04]
Sawtooth - Posts: 4114
With your setup you must use the Replay Chart manual method.
And use 'Accurate Trading System Back Test Mode'.

It will always be the most accurate for any system. And the speed must be slow enough so that the replay doesn't overwhelm the CPU or GPU. In other words, the slower the better for the most accurate.
[2020-05-27 13:30:49]
rainbow47 - Posts: 68
There is a problem which I realised during the Manual Replay Backtest.

The Study/Price refers to the secondary chart to capture the direction of the Renko Bar. It is supposed to deliver a +1 on a green brick and -1 on a red brick. The indicator was tested and works fine on the secondary chart.

The problem which I am facing now in the Manual Backtest is that for some reason the cell in the Spreadsheet Trading system becomes 0. A value which does not get created by the indicator. Durin the System Reply Backtest the number is always +1 or -1, as it supposed to be.

The outcome is thasht the system is missing many trades during th Manual Repaly Backtest.

Any idea what could cause the problem?



PS: "With your setup you must use the Replay Chart manual method." ===> Do you mean Single Chart or Multi Chart replay mode?
Date Time Of Last Edit: 2020-05-27 13:38:45
[2020-05-27 14:27:44]
Sawtooth - Posts: 4114
Do you mean Single Chart or Multi Chart replay mode?
If you have overlaid studies from other charts you must use 'All Charts In Chartbook'

To determine green and red Renko bricks, you must use the Renko Visual Open/Close Values study to get their open and close prices, instead of column B and column E prices.
Also, the current Renko bar doesn't use Renko open and close prices, it uses Columns B and E prices.
So the formula to determine green and red Renko bricks must use a combination of references:
=IF(ROW()=3,UseColumnBColumnE,UseRenkoOpenClose)

Here is the formula to use for non-Renko:
Spreadsheet Example Formulas and Usage: Formula that Matches the Coloring of Up and Down Price Bars
Edit it for Renko bars by referencing the Renko Visual Open/Close Values study instead of B and E columns.
Then combine them in one formula. (It will be a long formula).

Another note about overlaid studies in an autotrader:
There will sometimes be occasions where the entry signal disappears after an entry, or it appears late and you miss an entry. There is no solution to this anomaly regardless of the settings in the Study/Price Overlay study.
[2020-05-27 14:46:40]
rainbow47 - Posts: 68
Very helpful, thank you very much for your help. I will do some testing on the formulas.

Your last point regarding the issues with the autotrader and Study/Price is concerning. This could be one of the reasin for my issues.

I was thinking, that one way to fix this could be a subgraph study which shows me another Renko graph with a different brick size? This would allow me to stream all my data from one chart window into my spreadsheet study. Is something like this possible?
Date Time Of Last Edit: 2020-05-27 14:48:43
[2020-05-27 15:03:30]
Sawtooth - Posts: 4114
one way to fix this could be a subgraph study which shows me another Renko graph with a different brick size?
Even if it was possible, you'd encounter the same anomaly because the bar completion is 'random' between the two. It might actually be worse.
[2020-05-27 15:21:30]
rainbow47 - Posts: 68
Okay. Is this a Renko specific issue or a general problem with sthe Study/Price integrtion into an automated trading system? Does it mean it is not recommneded to use Study/Price for automated trading?

I am still wondering if the AutoTrading System Backtest provides the most accurate backtest results? My understanding is that it uses the close of the Renko bar, which is supposed to be the case in my trading system anyways.

The weird thing is I tested the System via Sim Trading today. The System Backtest and Single Chart backtest produce the same results as the Sim trading during the day. The backtest via All Charts in Chartbook produced different results and fror example trades were entered too late.

Initially I thought that the "Manual/All Charts in Chartbook" test would be more accurate for such a Renko system but I am now wondering why the other two test are much more precise? Do you know by any chance how the system gets the data for the second chart if I perform a backtest via Single Chart/System backtest?
[2020-05-27 17:11:39]
Sawtooth - Posts: 4114
Is this a Renko specific issue
It's not specific to Renko charts. It affects all bar types.

Does it mean it is not recommneded to use Study/Price for automated trading?
It can be problematic for the reason I mentioned, and you must be willing to accept the occasional erroneous/missed trades if you are going to use overlaid studies in an autotrader.
To be clear: This is not a bug with the Study/Price Overlay study; there is simply no way around it.

The System Backtest and Single Chart backtest produce the same results as the Sim trading during the day
Without further details, I can't explain why this happens in your system.

The backtest via All Charts in Chartbook produced different results.
I would expect different and more accurate results using All Charts In Chartbook.
Better results using Single Chart in a multichart system can't be more accurate.
- You can't use Trade >> AutoTrade System Bar Based BackTest with multiple charts.
- You can't control the speed or the start time with the Trade >> AutoTrade System Replay BackTest.
- Chart >> Replay Chart gives you the most control, and is the most accurate IMO. You should use this method for multichart systems, and don't use Single Chart or Standard Replay.

Do you know by any chance how the system gets the data for the second chart if I perform a backtest via Single Chart/System backtest?
It gets unsynchronized data from the other chart because there is no synchronization between charts when using Single Chart in a replay of a multichart system.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account