Indicator: How to plot in two different panels with one indicator?
I have an indicator that will be calculating/generating values on the price panel, it is also drawing there. However, I want to use some of the calculated values to be plotted in a separate panel on the same chart.
(Don't really like the idea of flipping variables that belong in Initialize.)
Is there a way to do this?
Another option would be to expose these values from indicator 1 (primary) and have a secondary indicator pick those values up and plot them in the second panel...not sure how to do this...I don't think instantiating the indicators inside each other will accomplish this?
I have global variables being set, but these are globals for all chart and strategy scripts. I want to share this data only between indicators on the same chart, but different panels.
Always good to see existing code, if there is any....
You can do it several ways with shared variables, but to be honest the easiest way is just to run two copies of the same indicator, and switch a parameter dialog option on/off between them to enable/disable what gets drawn. Rarely do you see much cpu impact, unless it's poor code or a beast.
NT7 certainly does not work well switching drawing between two panels using the DrawOnPricePanel variable, so don't waste any time on that route.
The following user says Thank You to ratfink for this post: