I am trying to make an efs alert for the tick. I have seen others on here but I didn't like them as a separate indicator and didn't know how to change them.
I thought this would work where each time the $tick reaches either +1000 or -1000 the alert would sound and bar would change color. It would need to reset automatically as well. Can anyone lend a hand?
I thought this would work where each time the $tick reaches either +1000 or -1000 the alert would sound and bar would change color. It would need to reset automatically as well. Can anyone lend a hand?
PHP Code:
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description
//{{EFSWizard_Declarations
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("tick");
//}}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 (
(0, 1, "$tick") >= 1000
) onAction1()
//}}EFSWizard_Expression_1
//{{EFSWizard_Expression_2
else if (
(0, 1, "$tick") <= 1000
) onAction2();
//}}EFSWizard_Expression_2
//}}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() {
Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Buzz.wav");
setBarBgColor(Color.RGB(255,0,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1
//{{EFSWizard_Action_2
function onAction2() {
Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Buzz.wav");
setBarBgColor(Color.RGB(0,255,0));
vLastAlert = 2;
}
//}}EFSWizard_Action_2
//}}EFSWizard_Actions
Comment