Hope you are doing well,
I am trying to plot previous highs & lows on a chart within a lookback period. I have the function that spits it out in the format below in a given time period (Highs and lows are in separate lists):
[[timeOfHigh1, PriceOfHigh1],[timeOfHigh2,PriceOfHigh2],…]
Ideally I want the chart to plot the highs and lows it detects over the given lookback with circles on a line chart with the closing prices (Line chart is already set up). I tried all sorts of ways to mess with scatter plots however I have had no luck. I have not found anything in the documentation or discussion posts that would allow me to be able to accomplish this either.
If anyone can guide me on which direction I should go regarding the plotting of the historical highs & lows whenever the function is called I would greatly appreciate it. Thank you for your time.
Yuri Lopukhov
If you want to plot something back in time, e.g. detect pivot point by looking back in history, then it is not possible in QuantConnect, it always plots in current point of time, you can't place anything in the past or in the future.
Ashutosh
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.
Ashutosh
Hello Mohammad Naqvi
While this may not be the exact implementation of what you are looking for to mark circles on previous highs and lows. We can make use of the rolling window mechanism of size “desired lookback” and then fill the values into the rolling window and clearing the rolling window after every “desired rolling lookback” to get the next max and min values.
For plotting we can make use of Scatter plots but we will only be able to plot after every lookback as the Chart() functionality does not take “x” axis as input. The idea was to store the date index for max or min and plot it as x but that did not work.
This however can be implemented in the research segment using matplotlib. (Backtest attached with implementation in research env)
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.
Mohammad Naqvi
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!