Hello, looking for help with making a volume “Oscillator”. When you look at a typical bar chart for volume, it shows volume either green or red. I am trying to make a volume graph that has volume either positive or negative based on the change in price. I am trying to use an SMA of the volume as the indicator to grab the most recent volume amount, then update itself with its own value but either positive or negative if the ROCP of the stock price is positive or negative.
Been playing around with this and updating the indicator with no luck. Looking to see if I am in the right direction and if anyone can give me some help to complete this. The ultimate goal is to be able to take a moving average of this volume “oscillator” so that if the stock is moving down most of the day that would also be reflected in this moving average of the volume, which would be negative.
Thank you, Tate
Louis Szeto
Hi Tate
We suggest you save a variable as the previous bar's price, then compare it with the current bar's price and plot the volume according to the side of the price movement. Please refer to the attached backtest. Note that you've used minute resolution, this would create more data points to the chart and easily reached the limit of charting. We suggest using a consolidator with volume as input to chart for more sparse data points.
Note that right now we're unable to customize color for Bar-type charts, we've referred this issue to the UX team for follow-up.
Best,
Louis Szeto
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.
Vladimir
Louis Szeto,
How would I test this
in
Tate Linzel
Hi Louis, Thank you for your answer, I was able to accomplish the same thing that you have done in the “On data” section. But I was looking to see if this could be done by updating an indicator like I was attempting to do? The reason being is I would like to be able to calculate a moving average of the volume “oscillator” using IndicatorExtensions.SMA or even apply any other indicator to it. With calculating the "oscillator" through the method you have shown, calculating any other indicator is inefficient.
so can it be done with updating an indicator?
Louis Szeto
Hi Vladimir, Tate
Vladimir, it would not be necessary to do so, as long as the ticker is subscribed on that day, it'll pass to this method at its end-of-day time. Instead of data[symbol], we recommend using self.Securities[symbol] or self.CurrentSlice[symbol] to obtain the Security's information.
Tate, is that meaning using this volume*sign as an indicator? We recommend using a custom datapoint update for manually updating indicators. Please check the attached backtest for example. It is also possible to create a custom indicator, check on this thread for its logic.
Best
Louis Szeto
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.
Tate Linzel
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!