[Indicator] Can I draw on the chart and at the same time, draw on a separate window?

 

Hello!

I would like to make an indicator in such a way that it draws on the price chart, and also to include a separate window with an oscillator. All in one single file and indicator.

Can this be done? Or something similar?

Cheers!

 
You can use Object()-Functions within indicators to draw on Price-Chart.
 
ubzen:
You can use Object()-Functions within indicators to draw on Price-Chart.

Hi flaab,

I think what ubzen meant was, from your subchart CI draw objects to main chart, because we can only use buffers on one chart only and not more.

 
onewithzachy:

Hi flaab,

I think what ubzen meant was, from your subchart CI draw object to main chart.

Can it be done the other way around? I am actually painting several histograms in the main chart. I would like to paint 3buffers another window (an oscillator) :-)
 
flaab:
Can it be done the other way around? I am actually painting several histograms in the main chart. I would like to paint 3buffers another window (an oscillator) :-)

Nope. CI can only accept one property

#property indicator_chart_window
=== or ====
#property indicator_separate_window
 

There are codes by WHRoeder which creates IIRC indicator buffers using Arrays; there are allot of his such examples. I recommend you do a good search.

In the end, indicator buffers are just arrays and oscillator's are just another method of drawing. What you ask for CAN be done but it requires some creativity.

Don't expect anyone to hold your hands and teach you how to do this one. I'm wondering why you cannot just make 2 separate indicators like everyone else, but I'm not even gonna bother asking why ;)

 

Thanks! Maybe another question, is there a suitable way of having more than 8 buffers in any indicator? Only 6 need to be public.

Or unlimited sized arrays for that matter :P

 
flaab:
Thanks a lot to both of you.
Let me guess, this still got to do with your "color paint all space projects", isn't ?
 
onewithzachy:
Let me guess, this still got to do with your "color paint all space projects", isn't ?

Oh yeah, I need much more internal buffers LOL! If we were using plain C I could do dinamic lists, but it is not the case with MQL.

I need 6 public buffers and 8 internal buffers :P

 
flaab:

Thanks! Maybe another question, is there a suitable way of having more than 8 buffers in any indicator? Only 6 need to be public.

Or unlimited sized arrays for that matter :P

No it's limited to that 8 only. I have this CI draw 16 lines at max (if I want it), need 2 internal 6 public buffer, have to create 3 CIs for it and sync'ed them all with globalvariables()
 
Yes, I understand. If not, I can always do two indicators and use Icustom, but my initial intention was to avoid that. Shoo! :D
Reason: