Indicator based on another indicator input

 

Hi,

 I would like to know how I would program a indicator that has another indicator as an input?

 

Example: I would like to put a Moving Average over a Average True Range.. So in human language I woud like something like EMA(ATR(15), 8)[0] to read the current 8EMA of the 15-period ATR. 

 

If somebody could point me into the right direction it would be much appreciated. 

 
daytradingzoo I would like to know how I would program a indicator that has another indicator as an input?
  1. If you just want it, drag the MA on top of the ATR and select price=previous indicator.
  2. If you want to code it, take the MA code and replace where it has price with iATR
  3. If you want the MA, read the ATR values into an array and use iMAOnArray
 
Thanks for your answer. How about if I would like to calculate the Bollinger Bands over let's say Volume.. I'm trying to insert iVolume into the iBands indicator in code. But iBands expects a PRICE enumerator. So inserting a iVolume value there would lead to errors I presume? I guess I'd have to create a new iBands version that does accept other inputs than PRICE enumerator. Unfortunately I cannot access / modify the iBands indicator because it's a system indicator. Any idea where I can get the source code?
 

You don't change the iBands call - you take the BB code and modify it "and replace where it has price with" iVolume.

And since volume is not a price, neither will the BB lines. You'll have to change the indicator to a separate window.

 
Great. Thanks I will try it WHRoeder. Thanks for taking the time to answer my question.
Reason: