Hello,
I'm novice in efs programmation and I need help concerning an indicator.
First of all, here is the actual program:
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
var vStoch5_1 = new StochStudy(5, 1, 3);
var vStoch14_1 = new StochStudy(14, 1, 3);
var vStoch45_1 = new StochStudy(45, 1, 14);
var vStoch75_1 = new StochStudy(75, 1, 20);
var vSMA9 = new MAStudy(9, 0, "Close", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("STPMT");
setCursorLabelName("STPMT", 0);
setCursorLabelName("MovAV", 1);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarThickness(1, 0);
setDefaultBarThickness(1, 1);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
//}}EFSWizard_PreMain
}
function main() {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
//}}EFSWizard_Expression_1
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return new Array(
(4.1*vStoch5_1.getValue(StochStudy.FAST)+2.5*vStoc h14_1.getValue(StochStudy.FAST)+1*vStoch45_1.getVa lue(StochStudy.FAST)+4*vStoch75_1.getValue(StochSt udy.FAST))/11.6,
null
);
//}}EFSWizard_Return
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//}}EFSWizard_Actions
OK, now I just want to add a simple 9-moving average of the constructed indicator (cfr Array of 2 values). How can this be done? I know this is surely quite simple but please help a
I'm novice in efs programmation and I need help concerning an indicator.
First of all, here is the actual program:
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
var vStoch5_1 = new StochStudy(5, 1, 3);
var vStoch14_1 = new StochStudy(14, 1, 3);
var vStoch45_1 = new StochStudy(45, 1, 14);
var vStoch75_1 = new StochStudy(75, 1, 20);
var vSMA9 = new MAStudy(9, 0, "Close", MAStudy.SIMPLE);
var vLastAlert = -1;
//}}EFSWizard_Declarations
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("STPMT");
setCursorLabelName("STPMT", 0);
setCursorLabelName("MovAV", 1);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarThickness(1, 0);
setDefaultBarThickness(1, 1);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
//}}EFSWizard_PreMain
}
function main() {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
//}}EFSWizard_Expression_1
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return new Array(
(4.1*vStoch5_1.getValue(StochStudy.FAST)+2.5*vStoc h14_1.getValue(StochStudy.FAST)+1*vStoch45_1.getVa lue(StochStudy.FAST)+4*vStoch75_1.getValue(StochSt udy.FAST))/11.6,
null
);
//}}EFSWizard_Return
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//}}EFSWizard_Actions
OK, now I just want to add a simple 9-moving average of the constructed indicator (cfr Array of 2 values). How can this be done? I know this is surely quite simple but please help a
Comment