Thanks Alex for the help. The only thing left is I can't seem to figure out where to put the bar thickness and colors for the 4 new bars that stay on top of background bars. Any answer on this?
Below is the fixed EFS with correct bar on top formula.
var study = new StochStudy(14, 3, 3);
function preMain()
{
setStudyTitle("Test Stoch 14,3,3 75,85,25,35");
setCursorLabelName("% K",0);
setCursorLabelName("% D",1);
setDefaultBarFgColor(Color.lime, 0); // %K
setDefaultBarFgColor(Color.red, 1); // %D
setDefaultBarThickness(3,0)
setDefaultBarThickness(3,1)
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
setStudyMin(10);
setStudyMax(85);
}
function main()
{
var vFAST = study.getValue(StochStudy.FAST);
var vSLOW = study.getValue(StochStudy.SLOW);
var UpBand1 = 80;
var UpBand2 = 70;
var DnBand1 = 20;
var DnBand2 = 30;
if((vFAST > vSLOW) && (vFAST > 70 )) //Entry to a long
{
setBarBgColor(Color.green);
}
else if((vSLOW > vFAST) && (vSLOW > 80)) //Exit from a long
{
setBarBgColor(Color.green);
}
else if((vFAST > vSLOW) && (vSLOW < 20 )) //Exit from short level
{
setBarBgColor(Color.maroon);
}
else if((vSLOW > vFAST) && (vSLOW < 30))//Entry to short level
{
setBarBgColor(Color.maroon);
}
return new Array (vFAST, vSLOW, UpBand1, UpBand2, DnBand1, DnBand2);
}
Below is the fixed EFS with correct bar on top formula.
var study = new StochStudy(14, 3, 3);
function preMain()
{
setStudyTitle("Test Stoch 14,3,3 75,85,25,35");
setCursorLabelName("% K",0);
setCursorLabelName("% D",1);
setDefaultBarFgColor(Color.lime, 0); // %K
setDefaultBarFgColor(Color.red, 1); // %D
setDefaultBarThickness(3,0)
setDefaultBarThickness(3,1)
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
setStudyMin(10);
setStudyMax(85);
}
function main()
{
var vFAST = study.getValue(StochStudy.FAST);
var vSLOW = study.getValue(StochStudy.SLOW);
var UpBand1 = 80;
var UpBand2 = 70;
var DnBand1 = 20;
var DnBand2 = 30;
if((vFAST > vSLOW) && (vFAST > 70 )) //Entry to a long
{
setBarBgColor(Color.green);
}
else if((vSLOW > vFAST) && (vSLOW > 80)) //Exit from a long
{
setBarBgColor(Color.green);
}
else if((vFAST > vSLOW) && (vSLOW < 20 )) //Exit from short level
{
setBarBgColor(Color.maroon);
}
else if((vSLOW > vFAST) && (vSLOW < 30))//Entry to short level
{
setBarBgColor(Color.maroon);
}
return new Array (vFAST, vSLOW, UpBand1, UpBand2, DnBand1, DnBand2);
}
Comment