[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Standard method to sync inputs across multiple indicators?



PureBytes Links

Trading Reference Links

Don't know if this is a standard method, but is simple and often works for
me, although I admit it is not very convenient.  I simply wrote a function
that uses passing by reference, it's sole purpose being assigning values to
its input variables.  Then, in order to change parameter's values in all the
functions and indicators, you have to change the values just once inside the
function.  For example the following function assigns the same values to
variables 1-3 for both of the indicators calling it:

{******* Indicator1 *******}
vars: var1(0), var2(0), var3(0), var4(0);
var4 = SameVar(var1, var2, var3);
Plot1((Close-var1)*var2-var3, "xxx");

{******* Indicator2 *******}
vars: var1(0), var2(0), var3(0), var4(0);
var4 = SameVar(var1, var2, var3);
Plot1((Close+var1)*var2+var3, "yyy");

Etc.

{******* Function SameVar *******}
{   Variables 1-3 are updated from here, not from the TS "Format Indicator"
window.   }
inputs:	var1(NumericRef), var2(NumericRef), var3(NumericRef);
var1 = 1;
var2 = 2;
var3 = 3;
SameVar=1;

I know this method is cumbersome to use, but at least it beats manually
changing values in all the various indicators.

Ivo