I am trying to develop a custom slope indicator which identifies sequences of n up or down bars.
The else branch of the OnBarUpdate() method looks like this:
{
slowEma.Set((2.0 / (1 + Slow)) * Input[0] +
(1 - (2.0 / (1 + Slow))) * slowEma[1]);
double avr = slowEma[0];
Value.Set(avr);
Print(Value[0].ToString("0.00");
slope = Slopes(Value); // Sorry, I left ut the call
}
This prints Value to the output window, but if I call Slopes() with many
different ways to reference Value, either by passing it directly or assuming
it is global, it fails.
Slopes(), as defined in Indicator.UserDefinedMethods, looks like this:
public int Slopes(DataSeries Value)
{
int retval = 0;
if(Value[0] > Value[1] && Value[1] > Value[2]) retval = 1;
if(Value[0] < Value[1] && Value[1] < Value[2]) retval = -1;
return retval;
}
How do I pass the reference to Value? Thanks
Comment