Hi,
When working with functions such as EMA(), MAX(), or DELAY(), is the period parameter based on the resolution? For example, the line below will return a 14 day EMA.
var ema = EMA("IBM", 14, Resolution.Daily);
However, will the line below return 14 day EMA or 14 second EMA? I think it will still return 14 day EMA, but I want to confirm.
var ema = EMA("IBM", 14, Resolution.Second);
Thanks!
Alexandre Catarino
The second statement will return the 14-second EMA.
Please note that you need to subscribe to data with resolution that is equal or higher to the indicator:
AddEquity("IBM", Resolution.Daily); var emaSec = ("IBM", 14, Resolution.Second); // throws ArgumentException var emaMin = ("IBM", 14, Resolution.Daily); // Ok
​AddEquity("IBM", Resolution.Second); var emaSec = ("IBM", 14, Resolution.Second); // Ok var emaMin = ("IBM", 14, Resolution.Daily); // Ok
AutomatedMachine
Awesome! Thanks, that clears it up nicely. I have 2 short follow up questions:
1: When using the helper method below, will emaDaily be updated only once a day, or will it hold 14 days of data updated every second?
AddEquity("IBM", Resolution.Second); var emaDaily = ("IBM", 14, Resolution.Daily); // Ok
2: When manually adding indicators instead of using the helper method, like in this example what's the best method of implementing a daily ema with when your universe has a resolution of 1 second?
Alexandre Catarino
In that case, emaDaily will be update it once a day. What is happening under the hood? Every second-resolution bar will be consolidated into a daily bar. Once the daily bar is consolidated, its values are used to update the indicator.
In that example, we are updating the EMA with Coarse Universe data which only comes in daily-resolution.
AutomatedMachine
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!