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.
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.
public class BasicTemplateAlgorithm : QCAlgorithm, IAlgorithm
{
//Initialize the data and resolution you require for your strategy:
public override void Initialize()
{
//Initialize the start, end dates for simulation; cash and data required.
SetStartDate(2012, 06, 01);
SetEndDate(2012, 12, 30);
SetCash(30000); //Starting Cash in USD.
AddSecurities("NYSE", Resolution.EOD);
AddSecurities("NASDAQ", Resolution.EOD);
SetRunMode(RunMode.Series); //Series or Parallel for intraday strategies.
}
//Handle TradeBar Events: a TradeBar occurs on every time-interval
public override void OnTradeBar(Dictionary data)
{
if(IsEod)
{
//remove yesterdays intraday data, to get ready for todays data
//this could be done smarter too where only the new securiteis
// are added and the old ones removed.
ClearSecurities(Resolution.Minute);
var selectedStocks = OnEndOfDay(data);
foreach(var selectedStock in selectedStocks)
{
AddSecurity(SecurityType.Equity, selectedStock, Resolution.Minute);
}
//also request the securities for open positions from yesterday
}
else
{
OnIntraday(data);
}
}
private IList OnEndOfDay(Dictionary data)
{
//select the most insteresting stocks based on eod data.
// could be volatility, volume, paterns, MAs...
return mySelectedStocks;
}
private void OnIntraday(Dictionary data)
{
//look for intraday patterns and trade them
}
}
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.
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!