Hello everyone,
I'm wondering how is it possible to use (4 hour) timeframe resolution, because resolution in lean only has daily hourly, minute and tick.
P.S I'm using custom forex data.
Thanks
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
User asks how to use 4-hour timeframe resolution in Lean with custom forex data.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
4 hour timeframe (Resolution)
Hanaa | April 2018
Hello everyone,
I'm wondering how is it possible to use (4 hour) timeframe resolution, because resolution in lean only has daily hourly, minute and tick.
P.S I'm using custom forex data.
Thanks
QuantConnectâ„¢ 2025. All Rights Reserved
Michael Manus
check the help for consolidators and the sample algso provided by the quantconnect team.
you have to use hour data with consolidator to scale it to 4 hour bars. check the examples!! and bootcamp
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.
Hanaa
Michael Manus thanks for your reply,
I tried the example but it is still doing trades on hours like 3/17..etc and it is supposed to make trades only on 0/4/8/12/16/20
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.
Michael Manus
share some code maybe.
take the very basic spy consolidation example:
1) change the resolution to hour.
without providing resolution infos Minute is default ( AddSecurity(SecurityType.Equity, "SPY", Resolution.Hour); )
2) Use the thirtyMinuteConsolidator and change it to 4 hours ( TimeSpan.FromMinutes(30) -> TimeSpan.FromHours(4) )! so that the ThirtyMinuteBarHandler-method gets called every 4th hour with a 4 hour candle
YOUR CODE IS STILL IN THE ONDATA METHOD? .......
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.
Hanaa
Michael Manus Yes i still have my code inside ONDATA, and i'm not using TradeBars, i'm using custom data (i read my data from CSV or dropbox).
What am i supposed to use instead of TradeBarConsolidator since i'm using custom data not tradebars?
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.
Hanaa
Michael Manus I fixed the issue but when i close a trade using SL or TP, it closes them on hourly basis not 4, for example it used to close trades on 3/15..etc which is wrong
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.
Michael Manus
maybe you have to consolidate it from minute resolution to hourly and than to 4 hours....so you can access it every minute if you need it....i dont know what your plans are.
example of this
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.
Hanaa
The point is that i don't use AddForex, AddEquity..etc because i use custom data and OnData looks like this
OnData(MyCustomDataClass data)
{
}
so it's giving me an error when i use TradeBarConsolidator or QuoteBarConsolidator
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.
Hanaa
That's the exception i'm getting when i use QuoteBarConsolidator (since i'm using custom Forex data):
System.ArgumentException: Type mismatch found between consolidator and symbol. Symbol: AUDUSD does not support input type: QuoteBar. Supported types: MyCustomDataClass.
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.
Luca Napo
For me .the Search API tree just doesnt work anymore since the update. I input searches and nothing happens..
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.
Ian Larson
I can't delete projects. I'd like to be able to delete ones I know have buggy code, and organize them into folders etc based on the algo. I've been cloning projects to build the next iteration of an algo each time so that I have the previous code for reference in case I break what I'd been working on.
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.
Gkiwi
I don't think this new terminal design is ready for live use. There is no discernable improvement to me. Now, it overheats my laptop now as soon as I start the terminal and keyboard editing lag has increased. Navigating is clunky having to close the console to get to the two left hand vertical menu open/close. Where are the Market Open Times for the dashboard now which are essential , especially for crypto, given the graphs x axis time did not report time as set by helper and was different from log time? What was the benefit of this change?
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.
Matthew Martin
A few minor things I have noted:
1) Backtest results do not open. It seems like anything over about 500 days is the trigger for when it hangs indefinitely. If I keep QC and the terminal open for the entire backtest without the screen going blank, I can have the backtest results for tests greater than 500 days. If I log out or the computer sleeps, I cannot get the backtest results.
2) Please move active backtests to the top of the list instead of to the end. If I want to kill a backtest I have to scroll all the way to end of the page(s) in the dropdown. Also, logically, the rest of the tests are in reverse chronological order while these newest tests are at the end.
3) For multiple backtests the system performance seems significantly slower than before. My computer slows to a crawl. Since the computation is being down elsewhere, I would guess it is the graphics.
4) This is very minor, but is there any way to not make the first file in the project auto-open? If the first file is not my "main" file, it is always opened even when not needed. So it takes up tab space or I have to close it every time.
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.
Dan Root
Two small functionalities I would like to know about.

Python helper feature.
1. Python intellisense . (Like in C#)
2. When coding in the IDE.
3. In the IDE. Seems to work with the research environment.
Wordwrap feature
1. Wordwrap feature.
2. When coding in the IDE.
3. In the IDE. Would be nice for small screens.
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.
Dan Root
Also, when running multiple backtests, I have an issue pressing the next arrow through the row of backtests.
1. When running multiple backtests on the IDE dashboard in the Algorithm Lab, I am having issues cycling through the different backtests via the over button.
2. When cycling through multiple backtests.
3. IDE / Backtesting environment.
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.
Douglas Stridsberg
In addition to getting my additional chart as a narrow window, I now can't view it at all:
Is there a way to manually switch back to the old design until things are ironed out with the new one? I appreciate that it's good to switch things up and integrate the backtest and live views, but for those of us with real money on the line it's a little harrowing when things don't work. I'd rather be the last person to switch over to a new design than to have to worry whether my real money strategy is working as expected. I appreciate that there's a distinction between the terminal and the actual running algorithm and that it's likely the algorithm itself is running fine, but I hope you get my point regardless. We should really be given the option to opt in and out of the new design, or perhaps a limited set of users should be enrolled as beta testers before pushing such big changes live. From user feedback it seems enough things don't work for it to warrant a closed beta or opt-in approach.
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.
Jared Broad
shape. We remember what you have open too so it'll save your layout
preferences.
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.
Clayton Berry
I'll also add that we need the ability to hide the API explorer to recover screen real estate. What's also weird is that intellisense isn't mirroring the API explorer. Here's an example when looking at the Portfolio object...why doesn't intellisense match?
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!