Trading signal is trigger by ema 10 day cross 50 day.
QUANTCONNECT COMMUNITY
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.
Jared Broad
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.
Quant Trader
ema10.Push(Securities["IBM"].Close); ema50.Push(Securities["IBM"].Close); if (ema10.EMA > ema50.EMA) {
The Push does only enque, not calculate the average. It is quite hard to debug online in the cloud to set a breakpoint to what your code is actually doing. So this is just a visual interpretation of your code. It would make sense since ema10.EMA is effective after 10 ticks and the ema50 needs 5 times more data. At start both are zero, so ema10.EMA is larger after 10 ticks. I assume data comes in every 1 minute, so N=10 and N=50 means you look on 10-50 minutes scale? J.Jared Broad
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.
Quant Trader
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using System.Linq; using QuantConnect; using QuantConnect.Models; namespace QuantConnect.Algorithm.Library { ///
/// An indicator shows the average value of secuitry's price
/// over a set period
///
public class ExponentialMovingAverage
{
private int _period;
private decimal _ema;
private bool _initialized;
private Queue _data = new Queue();
public void Clear()
{
_data.Clear();
}
///
/// EMA value
///
public decimal EMA
{
get { return _ema; }
}
private decimal ExponentialComponent
{
get { return (decimal) 2 / (_period + 1); }
}
///
/// Initialise the Algorithm
///
public ExponentialMovingAverage(int period)
{
_period = period;
_ema = 0;
_initialized = false;
}
public bool IsInitialized
{
get { return _initialized;}
}
///
/// Calculate the exponential moving average
///
public bool Push(decimal priceToday)
{
if (_initialized)
{
_ema = (1 - ExponentialComponent) * _ema + ExponentialComponent * priceToday;
//http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
}
else
{
_data.Enqueue(priceToday);
if (_data.Count >= _period)
{
_ema = _data.Average();
_initialized = true;
}
}
return _initialized;
}
}
}
Jared Broad
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.
Quant Trader
Craig Parker
Xiaoxiao
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!