var study = new StochStudy(8, 3, 3);
function preMain()
{
setStudyTitle("Stoch 8,3,3");
setCursorLabelName("% K",0);
setCursorLabelName("% D",1);
setDefaultBarFgColor(Color.lime, 0); // %K
setDefaultBarFgColor(Color.red, 1); // %D
setDefaultBarThickness(2,0)
setDefaultBarThickness(2,1)
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
addBand(80, PS_SOLID, 1, Color.purple);
addBand(70, PS_SOLID, 1, Color.purple);
addBand(30, PS_SOLID, 1, Color.purple);
addBand(20, PS_SOLID, 1, Color.purple);
setStudyMin(10);
setStudyMax(85);
}
function main()
{
var vFAST = study.getValue(StochStudy.FAST);
var vSLOW = study.getValue(StochStudy.SLOW);
if(vFAST > vSLOW) //Entry to a long
{
setBarBgColor(Color.green);
}
else if(vSLOW > vFAST) //Exit from a long
{
setBarBgColor(Color.maroon);
}
else if(vFAST > vSLOW) //Exit from short level
{
setBarBgColor(Color.green);
}
else if(vSLOW > vFAST) //Entry to short level
{
setBarBgColor(Color.maroon);
}
return new Array(vFAST, vSLOW);
}
function preMain()
{
setStudyTitle("Stoch 8,3,3");
setCursorLabelName("% K",0);
setCursorLabelName("% D",1);
setDefaultBarFgColor(Color.lime, 0); // %K
setDefaultBarFgColor(Color.red, 1); // %D
setDefaultBarThickness(2,0)
setDefaultBarThickness(2,1)
setPlotType(PLOTTYPE_INSTANTCOLORLINE);
addBand(80, PS_SOLID, 1, Color.purple);
addBand(70, PS_SOLID, 1, Color.purple);
addBand(30, PS_SOLID, 1, Color.purple);
addBand(20, PS_SOLID, 1, Color.purple);
setStudyMin(10);
setStudyMax(85);
}
function main()
{
var vFAST = study.getValue(StochStudy.FAST);
var vSLOW = study.getValue(StochStudy.SLOW);
if(vFAST > vSLOW) //Entry to a long
{
setBarBgColor(Color.green);
}
else if(vSLOW > vFAST) //Exit from a long
{
setBarBgColor(Color.maroon);
}
else if(vFAST > vSLOW) //Exit from short level
{
setBarBgColor(Color.green);
}
else if(vSLOW > vFAST) //Entry to short level
{
setBarBgColor(Color.maroon);
}
return new Array(vFAST, vSLOW);
}
Comment