I was trying to create a simple alarm alert when the bar changed direction so I would not have to watch the computer screen all of the time. I used the formula wizard. It works fine for both point break and candlesticks. What I really wanted it for was Renko. When you first apply the formula it produces the right signals. But as real time goes on it puts them on the chart at random. Anyone know how I can fix this?
Thanks
Randy
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vLastAlert = -1;
//}}EFSWizard_Declarations 2482
function preMain() {
//{{EFSWizard_Code_PreMain_setPriceBarColor
setColorPriceBars(true);
//}}EFSWizard_Code_PreMain_setPriceBarColor 3448
/**
* 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("_ALERT Trading System");
//}}EFSWizard_PreMain 8526
}
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 (
Strategy.isLong() == false &&
close() > close(-1)
) onAction1()
//}}EFSWizard_Expression_1 10932
//{{EFSWizard_Expression_2
else if (
Strategy.isShort() == false &&
close() < close(-1)
) onAction2();
//}}EFSWizard_Expression_2 14487
//}}EFSWizard_Expressions 46019
//{{EFSWizard_Return
return null;
//}}EFSWizard_Return 2256
}
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() {
if (vLastAlert != 1) Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setPriceBarColor(Color.RGB(0,255,0));
if (vLastAlert != 1) drawShapeRelative(0, low() -.0002, Shape.UPARROW, "", Color.RGB(0,255,255), Shape.LEFT);
if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\tminus[1].wav");
if (vLastAlert != 1) Strategy.setStop(low());
vLastAlert = 1;
}
//}}EFSWizard_Action_1 52955
//{{EFSWizard_Action_2
function onAction2() {
setPriceBarColor(Color.RGB(255,0,0));
if (vLastAlert != 2) Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
if (vLastAlert != 2) Strategy.setStop(high());
if (vLastAlert != 2) drawShapeRelative(0, high() + .0002, Shape.DOWNARROW, "", Color.RGB(0,255,255), Shape.LEFT);
if (vLastAlert != 2) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\tminus[1].wav");
vLastAlert = 2;
}
//}}EFSWizard_Action_2 54260
//}}EFSWizard_Actions 137112
Thanks
Randy
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vLastAlert = -1;
//}}EFSWizard_Declarations 2482
function preMain() {
//{{EFSWizard_Code_PreMain_setPriceBarColor
setColorPriceBars(true);
//}}EFSWizard_Code_PreMain_setPriceBarColor 3448
/**
* 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("_ALERT Trading System");
//}}EFSWizard_PreMain 8526
}
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 (
Strategy.isLong() == false &&
close() > close(-1)
) onAction1()
//}}EFSWizard_Expression_1 10932
//{{EFSWizard_Expression_2
else if (
Strategy.isShort() == false &&
close() < close(-1)
) onAction2();
//}}EFSWizard_Expression_2 14487
//}}EFSWizard_Expressions 46019
//{{EFSWizard_Return
return null;
//}}EFSWizard_Return 2256
}
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() {
if (vLastAlert != 1) Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
setPriceBarColor(Color.RGB(0,255,0));
if (vLastAlert != 1) drawShapeRelative(0, low() -.0002, Shape.UPARROW, "", Color.RGB(0,255,255), Shape.LEFT);
if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\tminus[1].wav");
if (vLastAlert != 1) Strategy.setStop(low());
vLastAlert = 1;
}
//}}EFSWizard_Action_1 52955
//{{EFSWizard_Action_2
function onAction2() {
setPriceBarColor(Color.RGB(255,0,0));
if (vLastAlert != 2) Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
if (vLastAlert != 2) Strategy.setStop(high());
if (vLastAlert != 2) drawShapeRelative(0, high() + .0002, Shape.DOWNARROW, "", Color.RGB(0,255,255), Shape.LEFT);
if (vLastAlert != 2) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\tminus[1].wav");
vLastAlert = 2;
}
//}}EFSWizard_Action_2 54260
//}}EFSWizard_Actions 137112