I'm trying to create the most simple candlestick chart based with consolidated data (I'm using Resoution.Second to consolidate tradebar, e.g. 45 seconds bars).
I also want to see on the chart the buy and sell, like this example from Ninja Trader:
I searched and found few older discussions:
but still didn't find a solution for it.
Any ideas?
I think it's basic to see candlestick chart with buy/sell entries, maybe I'm missing something, I would like to hear from you.
Nico Xenox
Hey Nevo Raz,
I played around a little bit and wasnt able to Plot a chart with the consolidated 45 second bars. Tbh I'm not sure if w're even allowed to print so much data into a chart because we have the 4000 limit cap.
Either way, if you try to plot buy and sell signal into candle chart this is one way to do it:
You can adjust the position of the triangle by changing the value that you substract by the price.
You will see the buy signals when you clone the algo.
Hope it helps ;)
Nevo Raz
Nico Xenox Thanks for your explanation.
About the 4000 data points limit:
If we add to the chart just one day of data (6.5 hours = 23,400 seconds of trading data) it gives us ~519 candles of 45 seconds each, it's still <4000. Even if each candle is made of 4 data points (OHLC) its 2076 points per graph, still <4000. In addition we have the buy/sell data points, obviously depends on the algorithm but for one day were limited to 1924 extra data points on the graph.
Bottom line the 400 data points shouldn't limit us if I'm right.
I hope someone else figured it out,
Derek Melchin
Hi Nevo,
The charting software on the backtest results page automatically groups the datapoints to create the candlesticks. We can't enforce the candlesticks to span a specific period of time. For more information about candlestick charts in backtests, see Supported Chart Types. As an alternative, if you save the OHLC values of the consolidated bars into the ObjectStore, you can load them into the Research Environment to create a candlestick plot with any of these third-party libraries.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Nico Xenox
Hey Nevo Raz, I followed Derek Melchin advice and build this small piece. I think by doing it this way, the only limitation you will have when wanting to plot a chart will be the 50 mb limit of the objectstore. (Chart is in Notebook)
One thing I wasnt able to do because I have not a lot of time was adding the buy / sell signals.
This can be archieved by saving the date values of the buy / sell order into a list. I already did that and saved it into the objectstore. The only problem I have is adding the triangles into the chart with the time values.
If there's a better way let me know. Whole thing is done with plotly 😊
Hope it helps ;)
Nico Xenox
Hey again,
I added this line of code for the buy signals:
The only problem is that the y-axis of the buy signal is not located 0.15 below the lowest point.
Also Derek Melchin the bokeh library cant be importe, there's an error.
Do you guys know what to change to make it work? Or add a code to the scatter that it is not allowed to touch the candlesticks.
Derek Melchin
Hi Nico,
To be notified when the bokeh library is supported again, subscribe to GitHub Issue #6639.
The triangle markers aren't in the correct position because buy_list and df['low'] aren't aligned. In this case, we can fix the issue by replacing df['low'] with df.loc[buy_list]['low']. See the attached notebook for reference.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Nevo Raz
Thanks a lot Nico Xenox for sharing this code, it's exactly what I was looking for, I'll work on it and share here my additions.
Thanks Derek Melchin for your support, using the ObjectStore can be very useful whenever we need to think/use outside the box(=QunatConnect platform limitations).
Nevo Raz
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!