Plot DLL output in main chart and separate window

 
Can someone show me where I can find an example of output from a DLL being plotted in separate windows, or direct me to the relevant part of the manual - i.e. one DLL writes to several indicator buffers and I want to plot a few of the buffers in the main chart and the others in one or more subwindows?
 

one indicator in separate window calls dll which updates buffers

one indicator in main window calls dll which updates other buffers.

 
Hi WHRoeder, From your answer I understand that there are two separate calls to the DLL, one call for each window. Am I right? If so, this is not really what I want as the second call to the DLL will unnecessarily recalculate 95% of the calculations done in the first call to the DLL. Perhaps I can provide a simple, explanatory example: one DLL calculates a series of moving averages AND two different oscillators, and obviously I would want to plot the averages in the main window and the oscillators in two separate subwindows. As I understand your suggestion the DLL is called first to plot the averages, a second time for the first oscillator plot, and a third and final time for the second oscillator plot, in this example a total of three calls to the DLL. This is an unnecessary overhead I wish to avoid if possible. I want to call the DLL once and have it plot the relevant parts of its output to the appropriate windows.
 
babelproof:
This is an unnecessary overhead I wish to avoid if possible. I want to call the DLL once and have it plot the relevant parts of its output to the appropriate windows.

Once indicator makes the calls but some buffers are not displayed

Other indicator gets the non-displayed buffers via iCustom

 
WHRoeder:

Once indicator makes the calls but some buffers are not displayed

Other indicator gets the non-displayed buffers via iCustom

Or store all values in the DLL so you can call the DLL as often as you want without needing it to recalculate anythng. And since old values don't change the dll has to update only the current bar or the new bar on every tick, not all the old bars, so there should not occur any noteworthy performance penalty. It would amount to exactly one additional function call per tick per window and the dll would have to update only one value in each buffer.
 

7bit,

How would I store values "in the DLL?" I know how to pass values to and from the DLL by reference, effectively storing values in an external array, but how would I store them in the DLL itself?

 
babelproof:

7bit,

How would I store values "in the DLL?" I know how to pass values to and from the DLL by reference, effectively storing values in an external array, but how would I store them in the DLL itself?

You allocate memoy on the heap and use it to store the arrays. If you need to use it on more than one chart at the same time then you could make a table to hold separate pointers to this data, one for each chart. Maybe use a hash table or something that can map a symbol name (something like "EURUSD15") to the pointer pointing to the relevant data for this chart and pass this symbol name to each dll function so it can look up in the hash table to find the pointer where its data is stored.

Allocate the memory and the hash table entry in init() and free it in deinit(). Do this in the master-indicator only, not in the slaves that only plot the existing data.

 
7bit Thanks for the info. I'm only two weeks into programming with MT4 at the moment and your solution sounds way beyond my current programming abilities. Could you point me to some online resources so that I can investigate this approach further? Googling doesn't seem to find much that helps me.
Reason: