I have this code which allows me to attach this EFS to any chart and it monitors StochD of the specified symbols in the code
But I need to also add monitors of ther 2EMA for each symbol, along with the StochD value, and I am not sure how to code this for EMA. I need the current value and also the last 2 previous values
Please help.
/************************************************** **************************************************
3:00 pm 21NOV06 US.efs
************************************************** ************************************************** *
latest fix:
to do:
************************************************** ************************************************** */
var vXX = 5
var vYY = 197
var DOWiSymbol = null;
var DOWValue = null;
var DOWValuePREV = null;
var bDOWMAXFLAG = false;
var bDOWOFF = false;
var iIntervalLO = null;
var vHI = 65;
var vLO = 35;
// LOCATION NOTES
// DOW: 5, 197
function preMain() {
setPriceStudy(true);
setStudyTitle("DOW SCANNER");
// setComputeOnClose();
iIntervalLO = new FunctionParameter("iIntervalLO", FunctionParameter.NUMBER);
iIntervalLO.setDefault( 1 );
DOWiSymbol = new FunctionParameter("DOWiSymbol", FunctionParameter.STRING);
DOWiSymbol.setDefault( "YM #F" );
}
function main(DOWiSymbol, iIntervalLO ){
if (!bDOWOFF) {
DOWValue = stochD(5,5,6,sym(DOWiSymbol + "," + iIntervalLO));
DOWValuePREV = DOWValue.getValue(-1);
if(DOWValue.getValue(0)==null) return;
if (DOWValue.getValue(0) >= vHI) {
if ( DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
bDOWMAXFLAG = true;
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.red, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.red, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
}
if (DOWValue.getValue(0)<= vLO) {
if ( DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
bDOWMAXFLAG = true;
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.green, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.green, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
}
if ( DOWValue.getValue(0) > vLO && DOWValue.getValue(0) < vHI && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
// removeText("DOW");
bDOWMAXFLAG = false;
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.RGB(212,212,212), Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( DOWValue.getValue(0) > vLO && DOWValue.getValue(0) < vHI && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
// removeText("DOW");
bDOWMAXFLAG = false;
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.RGB(212,212,212), Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( (DOWValue.getValue(0) > vHI && DOWValue.getValue(-1) < vHI) || (DOWValue.getValue(0) < vLO && DOWValue.getValue(-1) > vLO) ) {
if (getBarState() == BARSTATE_NEWBAR) {
vFlag = false;
var vData1 = 5;
var vData2 = 1;
if (vData1 > vData2 && vFlag == false) {
Alert.playSound("DOW-STOCH.wav");
vFlag = true;
}
}
}
} // endif this symbol
But I need to also add monitors of ther 2EMA for each symbol, along with the StochD value, and I am not sure how to code this for EMA. I need the current value and also the last 2 previous values
Please help.
/************************************************** **************************************************
3:00 pm 21NOV06 US.efs
************************************************** ************************************************** *
latest fix:
to do:
************************************************** ************************************************** */
var vXX = 5
var vYY = 197
var DOWiSymbol = null;
var DOWValue = null;
var DOWValuePREV = null;
var bDOWMAXFLAG = false;
var bDOWOFF = false;
var iIntervalLO = null;
var vHI = 65;
var vLO = 35;
// LOCATION NOTES
// DOW: 5, 197
function preMain() {
setPriceStudy(true);
setStudyTitle("DOW SCANNER");
// setComputeOnClose();
iIntervalLO = new FunctionParameter("iIntervalLO", FunctionParameter.NUMBER);
iIntervalLO.setDefault( 1 );
DOWiSymbol = new FunctionParameter("DOWiSymbol", FunctionParameter.STRING);
DOWiSymbol.setDefault( "YM #F" );
}
function main(DOWiSymbol, iIntervalLO ){
if (!bDOWOFF) {
DOWValue = stochD(5,5,6,sym(DOWiSymbol + "," + iIntervalLO));
DOWValuePREV = DOWValue.getValue(-1);
if(DOWValue.getValue(0)==null) return;
if (DOWValue.getValue(0) >= vHI) {
if ( DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
bDOWMAXFLAG = true;
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.red, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.red, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.red,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
}
if (DOWValue.getValue(0)<= vLO) {
if ( DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
bDOWMAXFLAG = true;
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.green, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( !bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.green, Color.white,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( bDOWMAXFLAG && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.green,
Text.LEFT | Text.RELATIVETOLEFT | Text.FRAME | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
}
if ( DOWValue.getValue(0) > vLO && DOWValue.getValue(0) < vHI && DOWValue.getValue(0) > DOWValue.getValue(-1) ) {
// removeText("DOW");
bDOWMAXFLAG = false;
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " + " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.RGB(212,212,212), Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( DOWValue.getValue(0) > vLO && DOWValue.getValue(0) < vHI && DOWValue.getValue(0) < DOWValue.getValue(-1) ) {
// removeText("DOW");
bDOWMAXFLAG = false;
drawTextAbsolute(vXX, vYY, " DOW = " + DOWValue.getValue(0).toFixed(0) + " - " + "@URL=EFSOWOFF", Color.RGB(255,255,0), Color.RGB(212,212,212), Text.LEFT | Text.RELATIVETOLEFT | Text.RELATIVETOTOP | Text.BOLD, null, 11, "DOW" );
}
if ( (DOWValue.getValue(0) > vHI && DOWValue.getValue(-1) < vHI) || (DOWValue.getValue(0) < vLO && DOWValue.getValue(-1) > vLO) ) {
if (getBarState() == BARSTATE_NEWBAR) {
vFlag = false;
var vData1 = 5;
var vData2 = 1;
if (vData1 > vData2 && vFlag == false) {
Alert.playSound("DOW-STOCH.wav");
vFlag = true;
}
}
}
} // endif this symbol
Comment