In my app, the universe is set to minute interval but I wish to get the day's high and low up until that point. How to achieve this?
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.
Retrieve intraday high and low prices for a universe with minute intervals in QuantConnect.
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
|
|
|||||||
|
|
||||||||
|
How to get current day's high/low price
Mheloky | mheloky | August 2016
In my app, the universe is set to minute interval but I wish to get the day's high and low up until that point. How to achieve this?
QuantConnectâ„¢ 2025. All Rights Reserved
Alexandre Catarino
Hi Mheloky,
You can achieve that using the Identity indicator:
var dailySpyHigh = Identity("SPY", Resolution.Daily, Field.High); var dailySpyLow = Identity("SPY", Resolution.Daily, Field.Low);
This inidicator is used to consolidate a data field (e.g.: Field.High, Field.Low) automatically with a chosen resolution.
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.
Boris Sachakov
@Alex,
I used your above wonderful template to find the day's High and Low and I included my custom data with 5-min periods to find a particular day's High and Low between 9:30am & 12:00pm. However I encountered the following problems with my version of the algorithm:
1. I couldn't figure how to properly enter info for intraday Time (in DailyBar class between DateTime EndTime and IsReady lines). I assume that it must include TimeSpan Period method, but I had no succes coming up with correct Syntax.
2. The result (Logs) I received after running the algorithm did not correspond to correct chart values. I believe it is due to problem # 1.
3. What does this line do in the above algorithm? :
Debug(Environment.NewLine + string.Join(Environment.NewLine, _dailyBars.Select(x => x.ToString())));
4. Variation of original question: How can I find Yesterday's High and Low while I am still using intraday data?
Thanks in advance.
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.
Petio Petrov
This method seems to give the previous day's high and low. How would we go about finding the high and low of the current day up to the current present moment?
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.
Petio Petrov
For anyone looking for a solution, turns out there is no function explicitly exposing that functionality yet. However, you can easily keep track of it yourself.
import sys def Initialize(self): self.symbol = 'SPY' self.SetStartDate(2018, 2, 1) self.SetEndDate(2018, 10, 14) self.AddEquity(self.symbol, Resolution.Minute) self.max_price = -sys.maxsize def OnData(self, data): if data[self.symbol] is None: return current_price = self.data[self.symbol].Price self.max_price = self.max_price if self.max_price > current_price else current_price
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!