Hi, is there anyone that know how to add 2 moving average to this oscillator?
I would to create 2 moving average, 1 fast and 1 slow, of this indicator, now I plot the code:
function preMain()
{
setStudyTitle("DiNapoli Detrended Oscillator");
setCursorLabelName("Detrend Osc",0);
setDefaultBarFgColor(Color.red,0);
addBand(0, PS_SOLID, 1, Color.black);
}
function main(nLength)
{
if (nLength == null)
nLength = 50;
var vPrice = getValue("Close",0,-nLength);
if(vPrice == null)
return;
var Detrend = 0.0;
var Sum = 0.0;
var i = 0;
//Average
for (i = 0; i < nLength; i++)
Sum += vPrice[i];
Detrend = vPrice[0] - Sum / nLength;
return Detrend;
}
thanks to everyone help me.
P.S. Excuse me for my english...
I would to create 2 moving average, 1 fast and 1 slow, of this indicator, now I plot the code:
function preMain()
{
setStudyTitle("DiNapoli Detrended Oscillator");
setCursorLabelName("Detrend Osc",0);
setDefaultBarFgColor(Color.red,0);
addBand(0, PS_SOLID, 1, Color.black);
}
function main(nLength)
{
if (nLength == null)
nLength = 50;
var vPrice = getValue("Close",0,-nLength);
if(vPrice == null)
return;
var Detrend = 0.0;
var Sum = 0.0;
var i = 0;
//Average
for (i = 0; i < nLength; i++)
Sum += vPrice[i];
Detrend = vPrice[0] - Sum / nLength;
return Detrend;
}
thanks to everyone help me.
P.S. Excuse me for my english...
Comment