Download MetaTrader 5

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

To add comments, please log in or register
Point Zero
795
Point Zero 2012.04.12 14:04 

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!

Ubzen
5394
Ubzen 2012.04.12 14:40  
You can use Object()-Functions within indicators to draw on Price-Chart.
onewithzachy
2271
onewithzachy 2012.04.12 15:36  
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.

Point Zero
795
Point Zero 2012.04.12 15:37  
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) :-)
onewithzachy
2271
onewithzachy 2012.04.12 15:42  
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
Ubzen
5394
Ubzen 2012.04.12 15:48  

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 ;)

Point Zero
795
Point Zero 2012.04.12 15:54  

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

onewithzachy
2271
onewithzachy 2012.04.12 15:59  
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 ?
Point Zero
795
Point Zero 2012.04.12 16:07  
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

onewithzachy
2271
onewithzachy 2012.04.12 16:17  
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()
Point Zero
795
Point Zero 2012.04.12 16:21  
Yes, I understand. If not, I can always do two indicators and use Icustom, but my initial intention was to avoid that. Shoo! :D
123
To add comments, please log in or register