I'm trying to track the daily range in a MAX indicator (TradeBar.High - TradeBar.Low).
I want to compare the max of daily range for x Days and emit insights based on the comparison.
I setup a SymbolData class and dictionary of symbols I'm tracking. In OnUpdate, and for history, I update the indictators.
In SymbolData.update when adding symbols, and in OnUpdate (Slice data). Resolution is Daily. I need to find out why Range9D is not tracking the range. It seems to be tracking the
public void update(TradeBar bar)
{
DayRange = (bar.High - bar.Low);
Bar = bar;
High50D.Update(bar.EndTime, bar.High);
Low50D.Update(bar.EndTime, bar.Low);
Range9D.Update(bar.EndTime, DayRange);
}
I'm not able to produce insights because the true daily range is never greater than the 9 day range. I can't figure out where the issue lies. The 9day range is tracking some version of a daily price instead. I submitted this to support already, but hoping maybe someone can tell me how to setup a range indicator. I just need to track MAX of (high - low) in a rolling 9 day indicator. MAX seems like it would be ideal. Maybe TR, but I don't think it tracks the time window.
A rolling window<TradeBar> seems like overkill, since I'm just tracking one value.
Sample debug output:
7/27/2015 3:00:00 PM-FB: O: 94.43 H: 94.5978 L: 93.84 C: 94.11 V: 2592541 - DayRange:0.7578 50DHigh:99.24 9DRange:97.76
Tim Bohmann
here's a three day run with two stocks. Day 1, day 2 9DRange is showing max range correctly. AAPL 3.85, IBM 3.08
next day APPL 3.85, IBM 2.30.
Day 3, BAM! what happened? Puzzling to me. You can see that the Day range is being calculated correctly.
Tim Bohmann
I think i solved it. I was creating indicators using the MAX helper with the symbol. Now using new Maximum() instead of algorithm.MAX helper.
Tim Bohmann
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!