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.
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!