Indicator with multiple (sub)windows? - page 2

 
Fantiago #: I tested further and can now tell that ChartIndicatorAdd() and — in that added indicator — iCustom() work well, so this could be a workaround. Just in case anybody wondered :-)

In terms of connecting data between indicators that are invoked through ChartIndicatorAdd, that isn't possible, but it is possible to invoke an indicator on the main window and subwindow at the same time with this function

 
Conor Mcnamara #: In terms of connecting data between indicators that are invoked through ChartIndicatorAdd, that isn't possible,

That part is technically correct in the strictest sense, however, there are workarounds for that using for example memory-based SQLite database. There are probably several others which did not immediately come to mind.

 
Fernando Carreiro #: That part is technically correct in the strictest sense, however, there are workarounds for that using for example memory-based SQLite database. There are probably several others which did not immediately come to mind.

My main use for ChartIndicatorAdd is in EA's. I have always assumed that this is ChartIndicatorAdd's primary purpose. I can certainly envision a bare bones EA that simply plots in a multitude of windows. I mentioned this in Post #10 but it was a retroactive edit so it may have been overlooked.

 
Ryan L Johnson #:My main use for ChartIndicatorAdd is in EA's. I have always assumed that this is ChartIndicatorAdd's primary purpose. I can certainly envision a bare bones EA that simply plots in a multitude of windows. I mentioned this in Post #10 but it was a retroactive edit so it may have been overlooked.

Yes, you are correct about the intention of that function!

If I remember correctly, ChartIndicatorAdd() will not work if the main custom indicator is called from iCustom(). I am not absolutely sure about this, so don't quote me, but I seem to have read this on a few other topics.

EDIT2:

However, the OP did state ... "I tested further and can now tell that ChartIndicatorAdd() and — in that added indicator — iCustom() work well, so this could be a workaround."

So, maybe it does work correctly when called from iCustom(). We lack the specifics of the OP's implementation.

However, when later in an EA, when calling on using this complex indicator, it will be difficult to collect all the buffer values from the various sub-indicators using a single iCustom() in the normal sense, requiring multiple iCustom() for each sub-indicator.

The OP may need to restructure their solution in another way.

 
Fernando Carreiro #:

Yes, you are correct about the intention of that function!

If I remember correctly, ChartIndicatorAdd() will not work if the main custom indicator is called from iCustom(). I am not absolutely sure about this, so don't quote me, but I seem to have read this on a few other topics.

I'm actually live trading my own custom EA that calls two chart window indicators and one sub window indicator, all via each's own iCustom(). Each called indicator has its own array, handle, and CopyBuffer(). Each called indicator also has its own ChartIndicatorAdd (referencing handle) and its own ChartIndicatorDelete (referencing indicator short name). Of course, this is a trading EA so it incorporates a main loop to iterate through the indicators' values. The OP could likely do without the loop and use the EA as a "conglomerate indicator." Just to clarify, there is no main custom indicator calling other indicators in my code.

I just saw your EDIT2. Yes!