Back

Moving Average of Low, High

interesting that the moving average with period 1 doesn't equal the base value...?

additionally, why doesn't the moving average show up for the first month of backtesting in my SMAs plot?
Update Backtest








SMA also doesn't show up for the most recent month of backtesting
0

If I understand question & code correctly -- I think its moving average of 1-day, the base data values are in minutes

Apologies the data is Feb 9th latest, the data updater cron job is a little behind. I'll run it today, by tomorrow or Saturday we should be back up to date :)
0

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.


I see. It was the 'if (!_bb.IsReady) return;' that was preventing the plotting in the first month.

So in the plotting it shows the SMA of the daily period, but lows for the first minute of each day?
0

Sorry about the delay, I was dealing with a memory leak and accountants! The code you shared will plot the low of each day period -- it builds the day bars from the lows of 390 trade bar's through the day.

The consolidators join data together over a period of time to a single trade bar. In this case they use the low of each unit-data. You can use the last argument (selector) to make it use almost anything for building the consolidated version.
0

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.


Hey Nathan, great to see your digging into the indicator system!

The following two lines will result in indicators with the same definition:
_smaLow = SMA(_symbol, 1, Resolution.Daily);
_smaHigh = SMA(_symbol, 1, Resolution.Daily);

The helper indicator functions (such as SMA, EMA, BB, ect...) perform the registration for you, so there's no need to call the RegisterIndicator function with them. If you do register an indicator that has already been registered then it will receive multiple updates, producing incorrect values. Additionally, the default value that gets sent into your indicator will be the Value property.

If you'd like a different value to be sent into your indicator, currently you'll need to manually create the indicator using the 'new' keyword and then register the indicator.
var _smaLow = new SimpleMovingAverage(1);
var _smaHigh = new SimpleMovingAverage(1);

RegisterIndicator(symbol, _smaLow, ResolveConsolidator(symbol, Resolution.Daily), x => ((TradeBar)x).Low);
RegisterIndicator(symbol, _smaHigh, ResolveConsolidator(symbol, Resolution.Daily), x => ((TradeBar)x).High);

Tomorrow I'll work on adding an overload to each of the indicator helper functions that accepts the 'selector' function so you could simply write:
_smaLow = SMA(symbol, Resolution.Daily, x => ((TradeBar)x).Low);
0

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.


wow thanks! I understand more now. I still don't quite get the x => ((TradeBar)x).Low... I don't even fully understand the => part yet...
0

A 'selector' is an anonymous function. Another term for these is lambda expressions.

The short story is that they represent an entire function or method call with the ceremony of defining one. Take as an example the lambda below:x => x.Property
This can be read as 'x becomes x dot property' and defines a function of a single parameter, x, that returns x.Property.

They're super handy at allowing calling code to specify intricate behavior without the need for additional classes/interfaces. I often think of it as an interface of a singular method.
0

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.


This was pushed to master in 3beb76d.
0

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.


ah ok, thanks!
0

ah ok, thanks!
0

Update Backtest





0

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.


Loading...

This discussion is closed