Can a function return a constant value without the history?
Posted: Sep 12 2015
by hughesfleming
I am calling a function that returns a period length and that period length has a history that varies and this works fine for adaptive indicators.
What I am trying to do is setup some bandpass filters which just receive the period length from the function without the history and then update on every new bar. I can't seem to figure out how to do this?
Any help would be greatly appreciated,
Alex
Re: Can a function return a constant value without the histo
Posted: Sep 12 2015
by TJ
I am calling a function that returns a period length and that period length has a history that varies and this works fine for adaptive indicators.
What I am trying to do is setup some bandpass filters which just receive the period length from the function without the history and then update on every new bar. I can't seem to figure out how to do this?
Any help would be greatly appreciated,
Alex
Not sure what you mean by "period length has a history".
The function can return whatever you want it to return.
Take a look at the Stochastic function; it is THE SAMPLE script for intermediate level function coding.
Re: Can a function return a constant value without the histo
Posted: Sep 12 2015
by hughesfleming
Thanks TJ,
What I mean is that the function will return a series of values which when used as an input to the bandpass filter will distort the filter which looks like a sine wave. I am interested in using just the value of the function at the current bar.
The function now may return a series of values eg. 21, 20,19,22. I am trying to get 21,21,21,21 and then to recalculate the whole indicator on the next bar which may have a value of 22 this time.
Sorry if my explanation was not very clear the first time.
regards,
Alex