I have an indicator (defined as an 'oscillator', i.e it is displayed in a frame underneath the price chart). I want it to paint the bar colours of the price chart, according to some computation.
I tried something like this...
- Code: Select all
open = instance:addStream("OPEN", core.Line, name .. ".OPEN", "OPEN", core.rgb(0,0,0), 0);
high = instance:addStream("HIGH", core.Line, name .. ".HIGH", "HIGH", core.rgb(0,0,0), 0);
low = instance:addStream("LOW", core.Line, name .. ".LOW", "LOW", core.rgb(0,0,0), 0);
close = instance:addStream("CLOSE", core.Line, name .. ".CLOSE", "CLOSE", core.rgb(0,0,0), 0);
host:execute("attachOuputToChart", "OPEN");
host:execute("attachOuputToChart", "HIGH");
host:execute("attachOuputToChart", "LOW");
host:execute("attachOuputToChart", "CLOSE");
instance:createCandleGroup(name, name, open, high, low, close);
But I just get the candle group drawn in the oscillator window. If I remove the 'instance:createCandleGroup' line, then I see the separate open,high,low,close lines in the price chart, so that bit is working - but the candle group only seems to get created in the oscillator frame.
Is it possible to do what I want to do?
Alternatively, I can create a 2nd indicator and have this handle the paint bars, but it would have been nice to do this from a single indicator.
Thanks.