when i test this indicator , i have value1=0
if someone can help me ?
Nuno
here the function
Code: Select all
{Type : Function, Name : NR_StoMoIndex}
input:
length1(NumericSimple),
length2(NumericSimple),
length3(NumericSimple),
StoMoIndex(numericref);
var:
HH(0),
LL(0);
HH = Highest(H,length1);
LL = Lowest (L,length1);
StoMoIndex = 100 * (XAverage(XAverage(C-(0.5*(HH+LL)),length2),length3) /
(0.5 * XAverage(XAverage(HH-LL,length2),length3)));
//NR_StoMoIndex = 1;
Code: Select all
{***********************************************************
Description NR_StoMoIndex : This Indicator plots Stochastic Momentum Index.
***********************************************************}
Inputs: Length1(10), Length2(20), Length3(2), UpColor(green), DwnColor(magenta);
Variables: StoMoIndex(0);
Value1 = NR_StoMoIndex(length1,length2,length3,StoMoIndex);
plot1( Value1, "StoMoIndex" );
plot2(0, "Zero");
If value1>value1[1] then
begin
plot1[1](value1[1],"StoMoIndex",upcolor);
plot1(value1,"StoMoIndex",upcolor);
end
else begin
plot1[1](value1[1],"StoMoIndex",dwncolor);
plot1(value1,"StoMoIndex",dwncolor);
end;