Please, can someone help to modifie this formula to change the bars colors, too?
/************************************************** *****************
Provided By : TS Support, LLC for eSignal. (c) Copyright 2002
************************************************** ******************/
function preMain()
{
setStudyTitle("Movtrend");
setCursorLabelName("Movtrend", 0);
setDefaultBarFgColor(Color.white, 0);
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
setDefaultBarThickness(2, 0);
setPriceStudy(true);
}
var wt = null;
var wt_1 = null;
function main(n) {
if(n == null)
n = 34;
var sum = 0;
var i = 0;
if(getBarState()==BARSTATE_NEWBAR){
wt_1 = wt;
}
for(i = n; i > 0; i--)
sum += (i - (n + 1) / 3) * close(i - n);
wt = 6 / (n * (n + 1)) * sum;
if(wt>wt_1)
setBarFgColor(Color.lime);
if(wt<wt_1)
setBarFgColor(Color.red);
return wt;
}
/************************************************** *****************
Provided By : TS Support, LLC for eSignal. (c) Copyright 2002
************************************************** ******************/
function preMain()
{
setStudyTitle("Movtrend");
setCursorLabelName("Movtrend", 0);
setDefaultBarFgColor(Color.white, 0);
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
setDefaultBarThickness(2, 0);
setPriceStudy(true);
}
var wt = null;
var wt_1 = null;
function main(n) {
if(n == null)
n = 34;
var sum = 0;
var i = 0;
if(getBarState()==BARSTATE_NEWBAR){
wt_1 = wt;
}
for(i = n; i > 0; i--)
sum += (i - (n + 1) / 3) * close(i - n);
wt = 6 / (n * (n + 1)) * sum;
if(wt>wt_1)
setBarFgColor(Color.lime);
if(wt<wt_1)
setBarFgColor(Color.red);
return wt;
}
Comment