Hello, I have a problem with my EFS script not plotting and coloring in the background like I am trying to have it done. I followed the example that ljd888 last posted on the thread http://forum.esignalcentral.com/show...threadid=15727 but I still have no plots or for "B" or "S" when there is a MA cross over. I don't know what I'm missing here, but could someone please help?
Currently nothing is printing in the Advanced Chart window
Here is my EFS script that I made with the Wizard.
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
var vEMA8 = new MAStudy(8, 0, "Close", MAStudy.EXPONENTIAL);
var vVWMA20 = new MAStudy(20, 0, "Close", MAStudy.VOLUMEWEIGHTED);
var vSMA50 = new MAStudy(50, 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(true);
setStudyTitle("8MA/20MA Cross with Backround Paint - WIZARD");
//}}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
if (
vSMA50.getValue(MAStudy.MA, -1) == null
) onAction1()
//}}EFSWizard_Expression_1
//{{EFSWizard_Expression_2
else if (
Strategy.isLong() == false &&
vEMA8.getValue(MAStudy.MA -1) < vSMA50.getValue(MAStudy.MA, -1) &&
vEMA8.getValue(MAStudy.MA) > vSMA50.getValue(MAStudy.MA)
) onAction2()
//}}EFSWizard_Expression_2
//{{EFSWizard_Expression_3
else if (
Strategy.isShort() == false &&
vEMA8.getValue(MAStudy.MA -1) > vSMA50.getValue(MAStudy.MA, -1) &&
vEMA8.getValue(MAStudy.MA) < vSMA50.getValue(MAStudy.MA)
) onAction3();
//}}EFSWizard_Expression_3
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return 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_Action_2
function onAction2() {
if (vLastAlert != 2) drawTextRelative(0, BelowBar1, "B", Color.RGB(0,0,255), Color.RGB(255,255,0), Text.PRESET | Text.BOLD, "Arial", 14);
if (vLastAlert != 2) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
Strategy.doLong("LONG", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setBarBgColor(Color.RGB(0,255,0));
vLastAlert = 2;
}
//}}EFSWizard_Action_2
//{{EFSWizard_Action_3
function onAction3() {
Strategy.doShort("SHORT", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setBarBgColor(Color.RGB(255,0,0));
if (vLastAlert != 3) drawTextRelative(0, AboveBar1, "S", Color.RGB(255,0,0), Color.RGB(255,255,0), Text.PRESET | Text.BOLD, "Arial", 14);
vLastAlert = 3;
}
//}}EFSWizard_Action_3
//}}EFSWizard_Actions
Currently nothing is printing in the Advanced Chart window
Here is my EFS script that I made with the Wizard.
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
var vEMA8 = new MAStudy(8, 0, "Close", MAStudy.EXPONENTIAL);
var vVWMA20 = new MAStudy(20, 0, "Close", MAStudy.VOLUMEWEIGHTED);
var vSMA50 = new MAStudy(50, 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(true);
setStudyTitle("8MA/20MA Cross with Backround Paint - WIZARD");
//}}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
if (
vSMA50.getValue(MAStudy.MA, -1) == null
) onAction1()
//}}EFSWizard_Expression_1
//{{EFSWizard_Expression_2
else if (
Strategy.isLong() == false &&
vEMA8.getValue(MAStudy.MA -1) < vSMA50.getValue(MAStudy.MA, -1) &&
vEMA8.getValue(MAStudy.MA) > vSMA50.getValue(MAStudy.MA)
) onAction2()
//}}EFSWizard_Expression_2
//{{EFSWizard_Expression_3
else if (
Strategy.isShort() == false &&
vEMA8.getValue(MAStudy.MA -1) > vSMA50.getValue(MAStudy.MA, -1) &&
vEMA8.getValue(MAStudy.MA) < vSMA50.getValue(MAStudy.MA)
) onAction3();
//}}EFSWizard_Expression_3
//}}EFSWizard_Expressions
//{{EFSWizard_Return
return 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_Action_2
function onAction2() {
if (vLastAlert != 2) drawTextRelative(0, BelowBar1, "B", Color.RGB(0,0,255), Color.RGB(255,255,0), Text.PRESET | Text.BOLD, "Arial", 14);
if (vLastAlert != 2) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
Strategy.doLong("LONG", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setBarBgColor(Color.RGB(0,255,0));
vLastAlert = 2;
}
//}}EFSWizard_Action_2
//{{EFSWizard_Action_3
function onAction3() {
Strategy.doShort("SHORT", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setBarBgColor(Color.RGB(255,0,0));
if (vLastAlert != 3) drawTextRelative(0, AboveBar1, "S", Color.RGB(255,0,0), Color.RGB(255,255,0), Text.PRESET | Text.BOLD, "Arial", 14);
vLastAlert = 3;
}
//}}EFSWizard_Action_3
//}}EFSWizard_Actions
Comment