ALex, I've been trying to write an EFS that should be easy, but i just don't seem to be able to do it. Could you please help me.
It is a simple EFS, I want to plot on a daily chart as an indicator the following condition.
For all of the past days i want to calculate the number of stocks in my array (the SOX index) that are above their 10 day simple moving average as a percentage from 0 % to 100%. I want to also be able to have the indicator update the calculation for each new update during the trading day, or update every 30 seconds or so. I've got my upper and lower bands on the chart, but i can't find any example of comparing the close data against the 10 day moving average. Please feel free to cut add anything you need to.
Thank you so much for your help.
Mike T.
/***/
function preMain() {
setStudyTitle("SEMI 10 DAY");
setShowCursorLabel("true");
setStudyMin(0);
setStudyMax(100);
setCursorLabelName("SEMI 10 DAY",0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarFgColor(Color.green, 0);
setDefaultBarFgColor(Color.maroon, 1);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(2, 1);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
}
var SymCount = 13;
var turnonflag = "false";
MySymbls = new Array("MXIM","KLAC","NSM","BRCM","LLTC","XLNX","NV LS","INTC","TXN","ALTR",
"STM","TER","AMAT","MOT","AMD","MU","TSM","LSI ");
function main() {
addBand(10,PS_SOLID,1,Color.green,2);
addBand(80,PS_SOLID,1,Color.red,1);
var p=0;
for (x=0; x<SymCount; x++) {
nSymb=MySymbls[x];
if(close(0,1,nSymb) > 8);
p=p+1;
}
return (p);
}
It is a simple EFS, I want to plot on a daily chart as an indicator the following condition.
For all of the past days i want to calculate the number of stocks in my array (the SOX index) that are above their 10 day simple moving average as a percentage from 0 % to 100%. I want to also be able to have the indicator update the calculation for each new update during the trading day, or update every 30 seconds or so. I've got my upper and lower bands on the chart, but i can't find any example of comparing the close data against the 10 day moving average. Please feel free to cut add anything you need to.
Thank you so much for your help.
Mike T.
/***/
function preMain() {
setStudyTitle("SEMI 10 DAY");
setShowCursorLabel("true");
setStudyMin(0);
setStudyMax(100);
setCursorLabelName("SEMI 10 DAY",0);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarFgColor(Color.green, 0);
setDefaultBarFgColor(Color.maroon, 1);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(2, 1);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
}
var SymCount = 13;
var turnonflag = "false";
MySymbls = new Array("MXIM","KLAC","NSM","BRCM","LLTC","XLNX","NV LS","INTC","TXN","ALTR",
"STM","TER","AMAT","MOT","AMD","MU","TSM","LSI ");
function main() {
addBand(10,PS_SOLID,1,Color.green,2);
addBand(80,PS_SOLID,1,Color.red,1);
var p=0;
for (x=0; x<SymCount; x++) {
nSymb=MySymbls[x];
if(close(0,1,nSymb) > 8);
p=p+1;
}
return (p);
}
Comment