Hi,
How can I get an email alert in to this trading system? I tried the code but than I get an email every second. How can I get an email one time? This is the code:
var study = new MAStudy(1, 0, "Close", MAStudy.SIMPLE);
function preMain() {
setPriceStudy(true);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
}
function main() {
var v = study.getValue(MAStudy.MA);
if(v == null)
return;
if(close() >= v && !Strategy.isLong())
Strategy.doLong("Crossing Up", Strategy.MARKET, Strategy.THISBAR);
if(close() < v && !Strategy.isShort())
Strategy.doShort("Crossing Down", Strategy.MARKET, Strategy.THISBAR);
if(Strategy.isLong())
setPriceBarColor(Color.lime);
else if(Strategy.isShort())
setPriceBarColor(Color.red);
return v;
}
How can I get an email alert in to this trading system? I tried the code but than I get an email every second. How can I get an email one time? This is the code:
var study = new MAStudy(1, 0, "Close", MAStudy.SIMPLE);
function preMain() {
setPriceStudy(true);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
}
function main() {
var v = study.getValue(MAStudy.MA);
if(v == null)
return;
if(close() >= v && !Strategy.isLong())
Strategy.doLong("Crossing Up", Strategy.MARKET, Strategy.THISBAR);
if(close() < v && !Strategy.isShort())
Strategy.doShort("Crossing Down", Strategy.MARKET, Strategy.THISBAR);
if(Strategy.isLong())
setPriceBarColor(Color.lime);
else if(Strategy.isShort())
setPriceBarColor(Color.red);
return v;
}
Comment