Download MetaTrader 5

ONE indicator writes TWO output windows ?

To add comments, please log in or register
Interested in social trading? Read the article!
Abejorro
165
Abejorro 2015.02.05 23:15 

Hello,

up to now I`ve only found codes that write in the main-chart OR in a seperate and new one. (#property indicator_chart_window)

But it is often useful, to address both or more outputs with only one mathematics. Mainly because of the performance. Else I have to calculate the nearly same thing twice. (simple example: MA in the mainchart and a crossover histogram with the same calculated buffers in a new window)

What is the way to do this ?


Thanks for your help !

Carl Schreiber
6588
Carl Schreiber 2015.02.06 08:52  
Make an indicator with a separate window. Now e.g. ObjectCreate() has the option to create s.th. on each of the existing sub-windows and the main chart.
Alain Verleyen
Moderator
30722
Alain Verleyen 2015.02.06 08:52  
Abejorro:


Hello,

up to now I`ve only found codes that write in the main-chart OR in a seperate and new one. (#property indicator_chart_window)

But it is often useful, to address both or more outputs with only one mathematics. Mainly because of the performance. Else I have to calculate the nearly same thing twice. (simple example: MA in the mainchart and a crossover histogram with the same calculated buffers in a new window)

What is the way to do this ?


Thanks for your help !

It's not possible.

You need more than 1 indicator, or you have to draw line/histogram yourself on the chart/window.

Keith Watford
Moderator
9618
Keith Watford 2015.02.06 11:20  
gooly:
Make an indicator with a separate window. Now e.g. ObjectCreate() has the option to create s.th. on each of the existing sub-windows and the main chart.
What does s.th.  mean?
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2015.02.06 11:24  
s.th. = something ?
Alain Verleyen
Moderator
30722
Alain Verleyen 2015.02.06 11:41  
Carl Schreiber
6588
Carl Schreiber 2015.02.06 12:03  

hmm - I know s.th. and s.o. from English vocable books:  do s.th. with s.o.

Abejorro
165
Abejorro 2015.02.06 12:08  

Oh, this is cruel !

Because ObjectCreate() seems to have a lot of administration and at first a existing subwindow...: Is it possible to load a indicator (the whole procedere including creating its new window) out of an EA or another indicator ? (like 'run' or so ?) I'm looking for a kind of meta-Level to manage and combine (!) stuff like in templates. (But there each replaces the other and will not be able to combine)


Still looking for the best performance, is there a way to get the whole buffer of a included indicator ? E.g. the iMA(...). We can get every single value in a loop. But behind that, it is calculating all the periods again and again. It is faster to pick the existing buffer inside than to ask for each value. Is there a way to point at this memory ?


I'm not really finished with understanding that

MyObject* hobject= new MyObject();

They say it is "Syntactically ... similar to pointers in C++" but "... is not a pointer to the memory". So, what for ? A Pointer is a way to write fast code.


Sorry for my questions and thanks a lot ! MQL4 is new stuff for me and sometimes a little surprising :-)

Carl Schreiber
6588
Carl Schreiber 2015.02.06 12:12  

You can define an OutputBuffer in your Indicator-for-other-Indicators and load its values with iCustom or mt4's technical indicators like ..g. iMA(..) or iCC(..).

But these will 'stay' in the indicator's window as angevoyageur said.

Keith Watford
Moderator
9618
Keith Watford 2015.02.06 13:02  
gooly:

hmm - I know s.th. and s.o. from English vocable books:  do s.th. with s.o.



I am English, but I have no idea what s.th or s.o mean.

Imagine what it must be like for people without English as their native language. 

Abejorro
165
Abejorro 2015.02.06 13:23  
gooly:

You can define an OutputBuffer in your Indicator-for-other-Indicators and load its values with iCustom or mt4's technical indicators like ..g. iMA(..) or iCC(..).

But these will 'stay' in the indicator's window as angevoyageur said.

Ok, let us see if we are talking the same. I know this iCustom() and others in that way: (symbolic)

double m_Buffer[];

   for(int pos = maxBars - itsPeriods; pos >= start; pos--)
   {
      // in two lines for better understanding
      double singleValue = iCustom(Symbol(), PERIOD_D1, "myIndicator", itsPeriods, 0, pos);
      m_Buffer[pos] = singleValue;
   }    

So it is walking along the data and calculates each value touching each base value itsPeriods-times. (may be 200 or so) But the code inside the indicator is ready shifting the old value and add a new one. Faster !

Or do I missunderstand, is this requested iXY() stacked for the next use without giving me a notice ?

If not, I was looking for a thing like that (NOT WORKING but to me a Request):

double m_Buffer[] = iCustom(Symbol(), PERIOD_D1, "myIndicator", itsPeriods, 0, ---- );

It`s because I got several times waiting for about 10sec. up to 45sec. to recalculate all the stuff in times of new big data.

12
To add comments, please log in or register