Trying to write a efs so I can manually enter price information for alerts. Why doesn't Source1 & 2 work ? When I hard code Source1 with high() - EntryPrice > .0010 the alert fires continually at any price > than entry and seems to ignore the .0010. When I use Source1 - EntryPrice > .0010 I get no alert.
I'm running this on EUR AO-FX with a current price of 1.2808
I'm running this on EUR AO-FX with a current price of 1.2808
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("Price_Alert");
setCursorLabelName("Price_AL", 0);
var fp1 = new FunctionParameter("Source1", FunctionParameter.STRING);
fp1.addOption("Close");
fp1.addOption("High");
fp1.addOption("Low");
fp1.addOption("Open");
fp1.addOption("HL/2");
fp1.addOption("HLC/3");
fp1.addOption("OHLC/4");
fp1.setDefault("High");
var fp2 = new FunctionParameter("Source2", FunctionParameter.STRING);
fp2.addOption("Close");
fp2.addOption("High");
fp2.addOption("Low");
fp2.addOption("Open");
fp2.addOption("HL/2");
fp2.addOption("HLC/3");
fp2.addOption("OHLC/4");
fp2.setDefault("Low");
var fp3 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp3.setName("Length");
fp3.setLowerLimit(1);
fp3.setDefault(5);
var fp4 = new FunctionParameter("EntryPrice", FunctionParameter.NUMBER);
fp4.setName("EntryPrice");
fp4.setLowerLimit(1);
fp4.setDefault(1000);
var fp5 = new FunctionParameter("Toggle", FunctionParameter.STRING);//PreTrade Alerts on or off
fp5.setName("Alerts On/Off");
fp5.addOption("On");
fp5.addOption("Off");
fp5.setDefault("Off");
}
function main(Source1, Source2, Length, EntryPrice, Toggle) {
if (Toggle != "Off"){
if (Source1 - EntryPrice > .0010) {
Alert.addToList(getSymbol(), "Price is > Entry", Color.black, Color.blue);
Alert.playSound("Buzz.wav");
}else {
if (EntryPrice - Source2 > .0010) {
Alert.addToList(getSymbol(), "Price is > Entry", Color.black, Color.red);
Alert.playSound("Buzz.wav");
}}}
return;
}
Comment