You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Your explanation is still unclear because I think you are still mixing up concepts.
You don't get data from an indicator via the price[]. "price[]" is not an output, it is is an input.
Indicators output buffers or plots and to access an indicator's "output", you use the CopyBuffer() function.
The only special case is when you want to feed the output of one indicator (it's first buffer), into the price[] input of another indicator to build a kind of "pipe" functionality. But this, does not seem to be what you are trying to achieve.
As far as I can tell, you are simply wanting to access the output data of indicators, be it one or many buffers or plots, and for that you should use the CopyBuffer() function.
What I wanted to do was create 2 indicators with iCustom within my master and within the oncalculate of the master, copy the data from each indicator and calculate a new indicator buffer. What I was trying to achieve by passing the _AppliedTo to each slave indicator was ensure they were using the same Applied Price as the master.
Yes, this is surely doable and makes sense. You just need to use the short form of OnCalculate.
After reading your initial post again, I think that you and I may be misunderstanding each other. So I am going to try re-explain things.
Now, with that in mind, your initial post does not actually reflect that. In your code sample, your supposed "master" is trying to "inject" an applied price into an indicator that is supposedly the "slave" which was not designed for an applied price.
So, trying to clarify your issue, it seems that you first need to understand that there are two types of indicators:
These two types are defined by what format their OnCalculate() event handlers takes:
Only the first format can take an applied price as an input.
Now, if you simply want to use standard applied price for the first format, then you don't need to any of this "master"/"slave" relationship. Just call the iCustom() function normally and define which price you want applied.
In essence, I may have misunderstood your question with your "master"/"slave" description.
Just use the first format of OnCalculate() in your indicator, and apply a price with your call to iCustom(), with the last parameter being the applied price.
Calling code:
Indicator code:
Hope that helps clarify a few things!
Have had another read of this with a fresh mind this morning and my fog is slowly rising.
Appreciate the explanation. I now need to code it and see things working.
Thanks for your patience and time Fernando
Yes, this is surely doable and makes sense. You just need to use the short form of OnCalculate.
Thanks Stanislav. I did use the short form also and still had the issue that _AppliedTo in the slave indicators was not showing the value passed into iCustom. I don't think that's important now though, it was the wrong test from a misunderstanding of the architecture. I was assuming that the slave indicators got their own data input rather than taking the input from the master indicator. So the slave indicators don't need to know the _AppliedTo, they just take input from prices[] in oncalculate. At least this is my current understanding , it's subject to change as my idiocy fades so feel free to correct me if it shows misunderstandings.
Thanks Stanislav. I did use the short form also and still had the issue that _AppliedTo in the slave indicators was not showing the value passed into iCustom. I don't think that's important now though, it was the wrong test from a misunderstanding of the architecture. I was assuming that the slave indicators got their own data input rather than taking the input from the master indicator. So the slave indicators don't need to know the _AppliedTo, they just take input from prices[] in oncalculate. At least this is my current understanding , it's subject to change as my idiocy fades so feel free to correct me if it shows misunderstandings.
That's incorrect. Your main indicator can technically invoke slave indicators for any data series different to the data used by the main, even for different symbol and timeframe. I'm not sure, if _AppliedTo is passed implicitly behind the scenes from the main indicator to subsidiaries.
I can confirm: there is STILL a bug that _AppliedTo is not reported to subsidiary indicators created via iCustom(..., _AppliedTo).
Initially reported in 2024.
I can confirm: there is STILL a bug that _AppliedTo is not reported to subsidiary indicators created via iCustom(..., _AppliedTo).
Initially reported in 2024.
Thanks for finding that out. I did come across that forum post but assumed it could have been user error rather than a confirmed bug. I'll work on a test example to get it working another way which I'm considering based on conversations with Fernando. Once done I'll post here. May take a while as other things have been put on hold while I've been down this rabbit hole.