Back

Daily resolution vs Minute resolution

I am trying to build a strategy with daily data, however, a run-time error showed "Sorry we do not have daily or hourly resolution yet. We recommend using minute data and building daily bars if required". Does this mean I have to use minute resolutions for all my tickers in my strategy in order to make it consistent? If so, how many minutes are included in a day? Is it regular trading hours only, or including pre-market, post-market hours or every minute in a day counts (24*60)?
Update Backtest








Hey Travis!

Have a peak in at the 'How do I use consolidators' in the university tab. It gives a quick sample of how to make daily bars from minute data.

In the short future (few days) we'll be releasing a more permanent solution providing direct support for both hourly and daily data.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


hello,
I am trying to calculate the RSI on a daily chart. I've followed the advice on using a consolidator, but the results are incorrect. Sorry if I am missing something obvious, I am just starting to learn this framework. Thanks!

Ken
0

Hey Ken!

Could you attach your project and backtest result so I can have a look? Also, when you say the results are incorrect what do you mean? Are you comparing against another source?
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


oh sorry, I thought I did. Here they are.

I am comparing against yahoo's finance data.

http://data.quantconnect.com/backtests/11385/77397/6020b085d20972c45e35cbc4f6650c18-log.txt
0


Hey @Ken!

Firstly, I would recommend to use our indicator system. The provided RelativeStrengthIndexCustom is an old implementation from before the indicator system.

I've attached a back test that uses the RSI indicator in various forms. I also recommend checking out the university tab on the left. There's one dedicated to the indicators called "How Do I Use Indicators? (ATR, BB, MACD, EMA, SMA, RSI)".

Typically, differences in indicator values on daily data stem from either data normalization or consolidated closing quotes. It is logical and expected to think that the closing price === last trade price, but this is not always true.

Our consolidators will end up using the last trade price as the closing price of the day, which may differ from the adjusted close posted and used by services like yahoo. When used in an indicator like the RSI, this can lead to some noticeable deltas. Another difference you may find with indicators that use any form of exponential smoothing is that the starting date will affect your data for many multiples of your indicator period. For example, using the RSI with Wilder's smoothing doesn't read 'true' values for ~150 time steps using a lookback period of 14.

We test our indicators using data exported from freestockcharts.com. These are the same guys who offer the TC2000 stock charting software. We pump their daily data through our indicators to verify that the results are equal given the same inputs.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi @MichaelH!

Have a question for you in regards to consolidators that I just ran into when playing with it. Took the code you just posted, made slight tweaks to it (date range & SPY instead of TSLA), and modified what's being logged from the OnDataDaily method. Is the output I'm seeing for the closing price correct?

2015-05-04 09:31:00 2015-05-04 09:31:00Z Close price: 210.70000000000000000000000000
2015-05-05 09:31:00 2015-05-05 09:31:00Z Close price: 211.33000000000000000000000000
2015-05-06 09:31:00 2015-05-06 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-07 09:31:00 2015-05-07 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-08 09:31:00 2015-05-08 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-11 09:31:00 2015-05-11 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-12 09:31:00 2015-05-12 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-13 09:31:00 2015-05-13 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-14 09:31:00 2015-05-14 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-15 09:31:00 2015-05-15 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-18 09:31:00 2015-05-18 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-19 09:31:00 2015-05-19 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-20 09:31:00 2015-05-20 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-21 09:31:00 2015-05-21 09:31:00Z Close price: 208.91000000000000000000000000
2015-05-21 16:00:00 Algorithm Liquidated


Edit: not sure why I can't seem to attach my project, but here's a direct link instead
https://www.quantconnect.com/terminal/results/05ca3d127a97063ac251fca203a82319
0

Didn't realize I had to also select a Backtest Result (hard stop validation before posting would be helpful here!). Hopefully this works now
1


Hey @Kevin!

It looks like the data updater if a little behind. I'll look into this tomorow.

We call the behavior you're noticing fill forward. When there is no data (maybe after hours) you can receive duplicated data. You can opt out of this using the following when adding a security:AddSecurity(SecurityType.Equity, "SPY", Resolution.Second, fillDataForward: false);
This will tell the engine to not duplicate data when it's missing.

It seems the first two data points are correct, here's the same algorithm attached but with fill forward off. You get this output:
2015-05-04 09:31:00 2015-05-04 09:31:00Z Close price: 210.70000000000000000000000000
2015-05-05 09:31:00 2015-05-05 09:31:00Z Close price: 211.33000000000000000000000000


You'll also notice that the time stamps are for the morning of the next day. Currently, the consolidators will produce the daily bar when it sees the first bar for the next day.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks @MichaelH! Please do drop a note once the data updater is pulling the latest.

Trying to just test a basic RSI > 70 sell, < 30 buy strategy based on intraday data to verify QC is working as expected (compared to other data providers), but as seen below, no trades were made in the short four day timespan where in actuality the minute timeframe RSI has fluctuated b/w 20 and 80 (due to data updater issue mentioned).

Given most brokers only provide a week's worth of intraday data, it's hard for me to vet the basic buy/sell on rsi conditions are working as expected (if in the project I posted above, May 4 is the latest data point where a trade was executed, long past the week window my brokers provide me).

Especially since intraday day/charting is a bit tricky as seen in this thread here, any suggestions for how I can prove what's being shown in my backtests (ie. entry/exit signals for the trades logged) are in fact lining up with what's happening in the real world (want to test the most basic use case and vet myself the algo should have in fact bought at xyz time, before building lines and lines of code on top of it)
0


Hey Kevin,

I've attached a project which spans a two days and plots the rsi and the execution points on the same chart. You can zoom in on the chart to view detail of single days, while zoomed out it may look odd due to down-sampling of the data

As mentioned, no trades were placed in your back test because there's no data over the time frame. We'll get the data updated as soon as possible.
1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi @MichaelH, thanks for providing the example, made the API docs a lot more clear! Also, apparently AAPL data is pulling the latest so I was able to take advantage of my broker's charting capabilities and match it back to the RSI plot you helped put together.

Two questions:
(1) If I wanted to have the custom chart show the timescale in seconds (rather than minutes) for the RSI indicator, is there a way? Thought it was based off of what I initialized the indicator as, but changing to Resolution.Second doesn't make a difference

(2) Not really a big deal, but is there a way to add additional details when I'm mousing over the chart? Ie. right now the RSI chart shows date + RSI, but what if I wanted to add time (minutes/seconds) or say a vertical and horizontal crosshair to make it easier to see support/resistances?
1

Also just one more data pt: my 15 min RSI seems to be picking up a weird buy signal on May 18th (RSI Chart) in the attached backtest. From TD Ameritrade (link), the RSI never drops below 30 on the 15 min chart on the 18th (though it does drop below 30 on the 14th, which doesn't match back correctly to the RSI plot in the backtest for the 14th - ie. no trade made given RSI never dipped below 30 according to QC).
0


Hey Kevin, in order to get the second resolution indicator you'll need to subscribe to second level data in initialize.AddSecurity(SecurityType.Equity, symbol, Resolution.Second);
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi, I noticed you mentioned that daily resolution would be added 'in the short future (few days) we'll be releasing a more permanent solution providing direct support for both hourly and daily data.' I was wondering if these have been added now (and I'm not using it properly) or if they are still in the works?

Thanks
0

Hey Rish!

I'm actually just finalizing some review of the implementation this morning! It turned out to be slightly more involved than expected. When it's deployed to the cloud I'll post a daily/hourly algorithm!
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks a lot. Just one follow up question. When you execute trades using the daily resolution, will the algorithm initiate the trades at the open price the next day by default?
0

Typically yes. If you use the 'MarketOrder' function your orders will actually be converted into a MarketOnOpen order. This is because the order is technically being placed at 12:00am (midnight). So after the following bar (next day) we'll use the opening price for the day to fill the MarketOnOpen order.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed