Hi,
I've created the following code to add alerts and text when a long trade should be made but only when it is not already in trade.
the problem is it generates the alerts and text for every bar that crosses the bollinger band.
I'm not sure if there is a problem with setting the trades or the stategy.long part of the code
please help
function ntrade() {
if (
close() > BollHigh.getValue(BollingerStudy.UPPER)
&& close() > open()
&& !Strategy.isLong()
){
LS = open();
Alert.addToList(getSymbol(), "BB Pi: Long: Stop @ "+LS, Color.RGB(128,255,128), Color.RGB(0,128,0));
Alert.playSound("d:\\Program Files\\eSignal\\Sounds\\GoLong.wav");
drawTextRelative(0, low()-.5, "L", Color.RGB(0,0,0), Color.RGB(255,0,255), Text.LEFT, "Arial", 8);
Strategy.doLong("", Strategy.OPEN(+1), Strategy.NEXTBAR, Strategy.DEFAULT, 0);
// Strategy.setStop(LS);
vLastAlert = 1;
}
}
I've created the following code to add alerts and text when a long trade should be made but only when it is not already in trade.
the problem is it generates the alerts and text for every bar that crosses the bollinger band.
I'm not sure if there is a problem with setting the trades or the stategy.long part of the code
please help
function ntrade() {
if (
close() > BollHigh.getValue(BollingerStudy.UPPER)
&& close() > open()
&& !Strategy.isLong()
){
LS = open();
Alert.addToList(getSymbol(), "BB Pi: Long: Stop @ "+LS, Color.RGB(128,255,128), Color.RGB(0,128,0));
Alert.playSound("d:\\Program Files\\eSignal\\Sounds\\GoLong.wav");
drawTextRelative(0, low()-.5, "L", Color.RGB(0,0,0), Color.RGB(255,0,255), Text.LEFT, "Arial", 8);
Strategy.doLong("", Strategy.OPEN(+1), Strategy.NEXTBAR, Strategy.DEFAULT, 0);
// Strategy.setStop(LS);
vLastAlert = 1;
}
}
Comment