I am new to QuantConnect and experimenting a little bit. I have a very simple algorithm, which attempts to keep the amount of dollars invested per symbol constant. With stock prices fluctuating, it is expected to trade a few shares pretty much every day. When running the algorithm with just one stock, it does exactly that. However, when running it with two or more stocks, it stops trading at some point (with 2 stocks on 2015/10/24). The more stocks I add, the earlier it will stop trading.
I have a hard time understanding what's going on here. Am I hitting some limitation? Are there any workarounds?
Any comments highly appreciated!
Alexandre Catarino
Hi Felix,
The algorithm didn't stop trading as the equity curve reaches the defined end date of your algorithm. On "Trades" tab, there is "Trades Summary" table with some of the trades and a link to download a csv file with all the trades.
Felix Bertram
Hi Alexandre,
thanks a lot for your response.
I downloaded the CSV with the trades and you are correct - the trades are all there.
So it seems that the Trades tab as well as the Stockplots only show a subset of what's really happening?
Cheers, Felix
Alexandre Catarino
Hi Felix,
There are limitations on what we can show in the IDE, because javascript browsers can only handle so many data points and so much RAM before they slow down and crash.
Felix Bertram
Hi Alexandre,
thanks again for your response, makes sense. For the list of trades this is not a big issue, and I can probably get used to it. For the stock plots this is a bit of a bummer, I would really like to see when the algorithm is entering trades. If I can't see all the trades, I'd at least like to see all positions opened and closed.
Overall, it would be much more clear to me (and probably others), if there was a marker on the list of trades and the stock plots indicating where data were omitted.
Thanks you,
Best regards, Felix
Alexandre Catarino
Hi Felix,
You can manually create charts and add series of scatter plots to see all the trades you are entering and exiting:
// In your initialize method: // Chart - Master Container for the Chart: var stockPlot = new Chart("Trade Plot"); // On the Trade Plotter Chart we want 3 series: trades and price: var buyOrders = new Series("Buy", SeriesType.Scatter, 0); var sellOrders = new Series("Sell", SeriesType.Scatter, 0); var assetPrice = new Series("Price", SeriesType.Line, 0); stockPlot.AddSeries(buyOrders); stockPlot.AddSeries(sellOrders); stockPlot.AddSeries(assetPrice); AddChart(stockPlot); // Later in your OnData(Slice data): Plot("Trade Plot", "Price", data.Bars["SPY"].Close);
I used your code above to give an example on how one could do it for multiple stocks.
Cheers,
Alex
Felix Bertram
Thanks a lot Alex, your help is highly appreciated.
Felix Bertram
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!