LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
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.
DavidAckman
109
,
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Basic template algorithm simply initializes the date range and cash. This is a skeleton
/// framework you can use for designing an algorithm.
/// </summary>
public class BasicTemplateAlgorithm : QCAlgorithm
{
//private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
public RollingWindow<TradeBar> Close5m;
public RollingWindow<TradeBar> Close1d;
public decimal chiusura5;
public decimal chiusura1;
public decimal chiusura2;
public decimal chiusura3;
public decimal chiusura4;
public decimal aperturaoggi;
public decimal massimogiornata;
public decimal minimogiornata;
public bool condition1;
public bool condition90;
public SimpleMovingAverage value1;
public decimal percent;
public decimal stopValue;
private OrderTicket CurrentOrder;
private OrderTicket StopLoss;
//private OrderTicket ProfitTarget;
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2014, 7, 1); //Set Start Date
SetEndDate(2018, 2, 23); //Set End Date
SetCash(100000); //Set Strategy Cash
// Find more symbols here: http://quantconnect.com/data
AddCrypto("BTCUSD", Resolution.Minute);
var fiveMinutes = new TradeBarConsolidator(TimeSpan.FromMinutes(5));
fiveMinutes.DataConsolidated += OnFiveMinutes;
SubscriptionManager.AddConsolidator("BTCUSD", fiveMinutes);
var dailyMinutes = new TradeBarConsolidator(TimeSpan.FromMinutes(1440));
dailyMinutes.DataConsolidated += OnDaily;
SubscriptionManager.AddConsolidator("BTCUSD", dailyMinutes);
Close5m = new RollingWindow<TradeBar>(10);
Close1d = new RollingWindow<TradeBar>(10);
value1 = SMA("BTCUSD", 3, Resolution.Daily);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
i think there is problem because people are trading their algos live...so it should work....
maybe describe the problems you see here?
and very important:
there is an OnOrderEvent code example in the documentation where you can follow the orders (with their ID) which get executed. In this OnOrderEvent that get called use the Time global variable which should also be decribed in the documentation so you SEE EXACTLE WHICH TIME THE ORDER GOT EXECUTED!
The problem is that it enters every 5 minutes the first trade as you see in the backtest, it's the same trade at the same entryprice . then it stops working
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...
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!