ISSUE : Two variables that should alter the VIDYA line behaviour, Length and Smooth.
If you change the smooth number (... and lenght unchanged), the viday line does change its form, HOWEVER when you change the length (...and smooth unchanged ) the vidya line does not change. WHY Not...
Then length should have an effect...I used 5 min bars to test it...
Original Code from :http://share.esignal.com/groupconten...ands&groupid=7
VIDYA Code Standard.....
function preMain()
{
setPriceStudy(true);
setStudyTitle("VIDYA");
setCursorLabelName("VIDYA", 0);
setDefaultBarFgColor(Color.red, 0);
}
var AbsCMO = 0.0;
var CurrentBar = 0;
var VIDYA = 0.0;
var VIDYA_1 = 0.0;
function main(Length, Smooth)
{
var BarState = getBarState();
if (Length == null) Length = 10;
if (Smooth == null) Smooth = 6;
var UP = 0.0;
var DN = 0.0;
var UpSum = 0.0;
var DnSum = 0.0;
var Close = getValue("Close", 0, -(Length + 2));
var i = 0;
for (i = 0; i < Length; i++)
{
if (Close[0] > Close[1]) UP = Close[0] - Close[1];
else UP = 0.0;
if (Close[0] < Close[1]) DN = Math.abs(Close[0] - Close[1]);
else DN = 0.0;
UpSum =+ UP;
DnSum =+ DN;
}
if ((UpSum+DnSum) > 0) AbsCMO = Math.abs((UpSum-DnSum)/(UpSum+DnSum));
var SC= 2/(Smooth+1);
if (CurrentBar <= Length) VIDYA = Close[0];
else VIDYA = (SC * AbsCMO * Close[0]) + ((1 - (SC * AbsCMO)) * VIDYA_1);
if (BarState == BARSTATE_NEWBAR) VIDYA_1 = VIDYA;
Return VIDYA;
}
If you change the smooth number (... and lenght unchanged), the viday line does change its form, HOWEVER when you change the length (...and smooth unchanged ) the vidya line does not change. WHY Not...
Then length should have an effect...I used 5 min bars to test it...
Original Code from :http://share.esignal.com/groupconten...ands&groupid=7
VIDYA Code Standard.....
function preMain()
{
setPriceStudy(true);
setStudyTitle("VIDYA");
setCursorLabelName("VIDYA", 0);
setDefaultBarFgColor(Color.red, 0);
}
var AbsCMO = 0.0;
var CurrentBar = 0;
var VIDYA = 0.0;
var VIDYA_1 = 0.0;
function main(Length, Smooth)
{
var BarState = getBarState();
if (Length == null) Length = 10;
if (Smooth == null) Smooth = 6;
var UP = 0.0;
var DN = 0.0;
var UpSum = 0.0;
var DnSum = 0.0;
var Close = getValue("Close", 0, -(Length + 2));
var i = 0;
for (i = 0; i < Length; i++)
{
if (Close[0] > Close[1]) UP = Close[0] - Close[1];
else UP = 0.0;
if (Close[0] < Close[1]) DN = Math.abs(Close[0] - Close[1]);
else DN = 0.0;
UpSum =+ UP;
DnSum =+ DN;
}
if ((UpSum+DnSum) > 0) AbsCMO = Math.abs((UpSum-DnSum)/(UpSum+DnSum));
var SC= 2/(Smooth+1);
if (CurrentBar <= Length) VIDYA = Close[0];
else VIDYA = (SC * AbsCMO * Close[0]) + ((1 - (SC * AbsCMO)) * VIDYA_1);
if (BarState == BARSTATE_NEWBAR) VIDYA_1 = VIDYA;
Return VIDYA;
}
Comment