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