I have an efs that tracks the StochD values on various futures. I am sure I got this code from the forum, and it works swell.
But I want to grab also the previous value of StochD and do a comparison, and I do not know how to get that previous value with the code as it is girven below.
I think it s more complicated than simply using a (-1) somewhere (where?, how?)
But I want to grab also the previous value of StochD and do a comparison, and I do not know how to get that previous value with the code as it is girven below.
I think it s more complicated than simply using a (-1) somewhere (where?, how?)
PHP Code:
/****************************************************************************************************
7:00 pm 20NNOV06 STochD-US.efs
*****************************************************************************************************
latest fix:
to do:
*****************************************************************************************************/
var DOWiSymbol = null;
var RUSiSymbol = null;
var iIntervalLO = null;
var bALERTON = false;
var DOWValue = null;
var RUSValue = null;
var bDOWOFF = false;
var bRUSOFF = false;
var vHI = 65;
var vLO = 35;
function preMain() {
setPriceStudy(true);
setStudyTitle("DOW SCANNER");
// setComputeOnClose();
DOWiSymbol = new FunctionParameter("DOWiSymbol", FunctionParameter.STRING);
DOWiSymbol.setDefault( "YM #F" );
RUSiSymbol = new FunctionParameter("RUSiSymbol", FunctionParameter.STRING);
RUSiSymbol.setDefault( "AB #F" );
iIntervalLO = new FunctionParameter("iIntervalLO", FunctionParameter.NUMBER);
iIntervalLO.setDefault( 1 );
}
function main(DOWiSymbol, RUSiSymbol, iIntervalLO ){
if (!bDOWOFF) {
DOWValue = ( stochD(5,5,6,sym(DOWiSymbol + "," + iIntervalLO)) ).toFixed(0);
if (DOWValue >= vHI) {
drawTextAbsolute(5, 197, " DOW = " + DOWValue + " " + "@URL=EFS:DOWOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if (DOWValue <= vLO) {
drawTextAbsolute(5, 197, " DOW = " + DOWValue + " " + "@URL=EFS:DOWOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if (DOWValue > vLO && DOWValue < vHI) {
// drawTextAbsolute(1, 137, " DOW = " + DOWValue + " " + "@URL=EFS:DOWOFF", Color.RGB(255,255,0), Color.blue,
// Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
// bDOWOFF = false;
removeText("DOW");
}
}
if (!bRUSOFF) {
RUSValue = ( stochD(5,5,6,sym(RUSiSymbol + "," + iIntervalLO)) ).toFixed(0);
if (RUSValue >= vHI) {
drawTextAbsolute(5, 217, " RUS = " + RUSValue + " " + "@URL=EFS:RUSOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "RUS" );
}
if (RUSValue <= vLO) {
drawTextAbsolute(5, 217, " RUS = " + RUSValue + " " + "@URL=EFS:RUSOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "RUS" );
}
if (RUSValue > vLO && RUSValue < vHI) {
// drawTextAbsolute(10, 137, " RUS = " + RUSValue + " " + "@URL=EFS:RUSOFF", Color.RGB(255,255,0), Color.blue,
// Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "RUS" );
// bRUSOFF = false;
removeText("RUS");
}
}
//
} // end MAIN
Comment