Backtesting: IOG or two data streams?

Questions about MultiCharts and user contributed studies.
bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Backtesting: IOG or two data streams?

Postby bluefightingcat » 16 Nov 2015

Hi,

I was wondering whether which would produce more accurate results in Portfolio Manager backtester considering that barmagnifier is not available in Portfolio Manager. My strategy relies on 1 day data to find entry signals but I want to open a position as soon as the entry signal rule is met and not at the end of the bar (i.e. next day). I guess these are the options:

1. Use just 1 day resolution as Data1 and use IOG

or

2. Use 1 minute data for Data1 and 1 day data for Data2.

I'm leaning towards the second option.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Backtesting: IOG or two data streams?

Postby tony » 16 Nov 2015

Unless it has changed, which I believe it has not, when you backtest using more than one data series, the data series not being traded are only calculated on OHLC values, not at other points. As a result your backtests will not be accurate at all.

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Backtesting: IOG or two data streams?

Postby bluefightingcat » 16 Nov 2015

So what would be the most accurate way to backtest?

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Backtesting: IOG or two data streams?

Postby tony » 16 Nov 2015

One data series would be most accurate. A decision to use IOG mode or not should not be a function of accurate backtest results but your strategy. With one data series and IOG mode or not, results should be pretty accurate. Unless of course you are scalping say ES and want to test further back than your data provider has tick resolution. In an instance like that you will get erroneous results where tick data is not available.

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Backtesting: IOG or two data streams?

Postby bluefightingcat » 16 Nov 2015

Ok.

Imagine this strategy. I want to buy stocks 15 minutes before the NASDAQ and NYSE close. I want to buy the top 5 stocks with the lowest RSI(14).

I want the RSI to be calculated "in real time" based on "1 day" data. However I also want to be able to buy the stock before the market closes i.e. as mentioned above: about 15 minutes before the market closes on that day.

My main aim would be to backtest this strategy. Actually trading at this point would be done manually.

I would imagine I would need to use IOG in backtesting since if I don't use it. Any "buy" signals would be filled only at the opening tomorrow and not 15 minutes before close.

Now I understand that IOG will only allow me to backtest using OHLC (as opposed to executing orders at a specific time during market opening hours). However I would be happier with this option compared to the option of buying the next day.

See what I mean??

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Backtesting: IOG or two data streams?

Postby TJ » 16 Nov 2015

Ok.

Imagine this strategy. I want to buy stocks 15 minutes before the NASDAQ and NYSE close. I want to buy the top 5 stocks with the lowest RSI(14).

I want the RSI to be calculated "in real time" based on "1 day" data. However I also want to be able to buy the stock before the market closes i.e. as mentioned above: about 15 minutes before the market closes on that day.

My main aim would be to backtest this strategy. Actually trading at this point would be done manually.

I would imagine I would need to use IOG in backtesting since if I don't use it. Any "buy" signals would be filled only at the opening tomorrow and not 15 minutes before close.

Now I understand that IOG will only allow me to backtest using OHLC (as opposed to executing orders at a specific time during market opening hours). However I would be happier with this option compared to the option of buying the next day.

See what I mean??
You might "think" you are trading on a daily chart.
But in reality, your analysis, your system, your criteria, are based on a 15 min system.

Choose your tools accordingly, and you will subdue your nemesis with ease.

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Backtesting: IOG or two data streams?

Postby bluefightingcat » 16 Nov 2015

You might "think" you are trading on a daily chart.
But in reality, your analysis, your system, your criteria, are based on a 15 min system.
Care to elaborate?

If I setup a watchlist in the Multicharts scanner with a stock using "1 day" resolution and add a study to my watchlist to calculate the RSI(14) based on the last 14 days of close prices. The RSI value will constantly update throughout the market day as the price moves up and down. Are you implying that the "realtime" RSI figure in my watchlist is based on tick(or minute or 15 minute) data?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Backtesting: IOG or two data streams?

Postby TJ » 16 Nov 2015

You might "think" you are trading on a daily chart.
But in reality, your analysis, your system, your criteria, are based on a 15 min system.
Care to elaborate?

If I setup a watchlist in the Multicharts scanner with a stock using "1 day" resolution and add a study to my watchlist to calculate the RSI(14) based on the last 14 days of close prices. The RSI value will constantly update throughout the market day as the price moves up and down. Are you implying that the "realtime" RSI figure in my watchlist is based on tick(or minute or 15 minute) data?
Scanner?
You are adding complexity that is not in your original question.


In backtest, nothing is real.
In realtime, of course the RSI is real time.
In realtime, everything is updated tick-by-tick, unless you specify the indicator to update only at EOB.

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: Backtesting: IOG or two data streams?

Postby tony » 16 Nov 2015

Ok.

Imagine this strategy. I want to buy stocks 15 minutes before the NASDAQ and NYSE close. I want to buy the top 5 stocks with the lowest RSI(14).

I want the RSI to be calculated "in real time" based on "1 day" data. However I also want to be able to buy the stock before the market closes i.e. as mentioned above: about 15 minutes before the market closes on that day.

My main aim would be to backtest this strategy. Actually trading at this point would be done manually.

I would imagine I would need to use IOG in backtesting since if I don't use it. Any "buy" signals would be filled only at the opening tomorrow and not 15 minutes before close.

Now I understand that IOG will only allow me to backtest using OHLC (as opposed to executing orders at a specific time during market opening hours). However I would be happier with this option compared to the option of buying the next day.

See what I mean??
Without studying this the only thing that comes to mind is if you can specify in MC when the "day ends" by that I mean in your case you ideally want the day to end 15 minutes before the close. I have no idea if you can set that or not. Before you go too far down the road of evaluating something you may not ever intend to trade I would ask a question, why buy 15 minutes before the close and have the overnight risk? Why not wait until the morning / open based on the prior day close? Just something for you to think of, no need to share your strategy with me / anyone here. If you want to buy 15 minutes before the close then add a conditional to your buy / sell short conditionals that says if time = 1545 for example that way if everything is true then at the 1545 bar a order will generate, but this does get into using 15 minute bars on a data2 purely for time so you'd say if time of data2 = 1545 as part of your conditional. Good luck.

Edit - your buy next bar at open; whatever type of order you generate though may have to be based off data2 if that is possible as well.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Backtesting: IOG or two data streams?

Postby evdl » 16 Nov 2015

What you see in the scanner when there is realtime data, is the update per tick of the daily RSI. (when update per tick is selected in the indicator).

In portfolio manager it's not possible to replicate this, because the barmagnifier is not available.

If you want to backtest this and get the same update per tick of the daily RSI (like with realtime data), you can only do this on a chart but you have to use a signal for this (scanner does not support signals btw). Set the barmagnifier on 1 tick, Real Time History match off, and IOG on.

And use this:
Set data1 as 1 day.

Code: Select all

Vars: intrabarpersist RSI_value(0);

RSI_value = RSI(close, 14);
This will give you in backtest and realtime, a tick by tick calculating of the daily RSI.

With a time variabel you can enter at any time on the day, when you RSI has met your conditions. But be careful, because there has to be a tick update on the chart or in realtime on the set time. Or otherwise you entry is not triggered

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Backtesting: IOG or two data streams?

Postby bluefightingcat » 17 Nov 2015

To make things a little clearer, this is what I would do when I trade manually:

- I would open up my scanner 15 minutes before market close.
- I would search for all stocks that have a daily RSI(14) that is below 5 at that moment.
- I would buy the stocks based on some other minor criteria.

So based on the discussion my understanding is that the scanner updates the daily RSI(14) based on tick data i.e. the last tick would be considered the "close" price.

Would it be possible to achieve the same thing for backtesting purposes?

Is it possible to use e.g. a 1 minute datafeed (I don't have access to tick data) to get "real time" daily RSI(14)?

I can then use the 1 minute datafeed to also ensure that all stocks are bought before the close of the market.
Before you go too far down the road of evaluating something you may not ever intend to trade I would ask a question, why buy 15 minutes before the close and have the overnight risk?
The whole purpose of backtesting is to have some idea of what is worth doing. I would like to use backtesting to test different options as one of the tools in evaluating what strategies work and when/how.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Backtesting: IOG or two data streams?

Postby evdl » 17 Nov 2015

To make things a little clearer, this is what I would do when I trade manually:

- I would open up my scanner 15 minutes before market close.
- I would search for all stocks that have a daily RSI(14) that is below 5 at that moment.
- I would buy the stocks based on some other minor criteria.

So based on the discussion my understanding is that the scanner updates the daily RSI(14) based on tick data i.e. the last tick would be considered the "close" price.
==> That is correct
Would it be possible to achieve the same thing for backtesting purposes?
==> only possible on chart, see earlier post.
Is it possible to use e.g. a 1 minute datafeed (I don't have access to tick data) to get "real time" daily RSI(14)?
===> No, but you can use the barmagnifier with 1 minute. And you will get OHLC of a minute timeframe. That is four points in the minute bar. This is not the same as you see realtime. You can determine if this is ok or not.
I can then use the 1 minute datafeed to also ensure that all stocks are bought before the close of the market.
==> for backtesting, you need to use a signal on a chart and only one datafeed and that is daily, with the barmagnifier on 1 minute and IOG on. You need to have the 1 minute data of the symbol. With a time variabel you can trigger your entry. Again be aware that there is an 1 minute update at the time you want to enter otherwise your entry will not be triggered.


Return to “MultiCharts”