Could someone take a look at the following script and tell what the problem is. It does not play the sound and it does not draw the text properly.
Thanks
function preMain() {
setStudyTitle("Price Alert");
setPriceStudy(true)
var fp1 = new FunctionParameter("Price1", FunctionParameter.NUMBER);
fp1.setName("Price > _____");
fp1.setLowerLimit(0);
fp1.setDefault(1.8500);
var fp2 = new FunctionParameter("Price2", FunctionParameter.NUMBER);
fp2.setName("Price < _____");
fp2.setLowerLimit(0);
fp2.setDefault(1.8500);
var fp3 = new FunctionParameter("Alert", FunctionParameter.STRING);
fp3.setName("Sound");
fp3.addOption( "On" );
fp3.addOption( "Off" );
fp3.setDefault("Off");
}
function main(Alert, Price1, Price2) {
if ( Alert == "On" && close() > Price1){
removeImage("PA1");
drawTextRelative(0, (high() + .0075), "Price Alert", Color.white, Color.red, Text.VCENTER|Text.CENTER, "Arial", 14, "PA1");
Alert.playSound("beam1.wav");
}
if ( Alert == "On" && close() < Price2){
removeImage("PA2");
drawTextRelative(0, (low() - .0075), "Price Alert", Color.white, Color.red, Text.VCENTER|Text.CENTER, "Arial", 14, "PA2");
Alert.playSound("beam1.wav");
}
If ( Alert == "Off");{
}
return
}
Thanks
function preMain() {
setStudyTitle("Price Alert");
setPriceStudy(true)
var fp1 = new FunctionParameter("Price1", FunctionParameter.NUMBER);
fp1.setName("Price > _____");
fp1.setLowerLimit(0);
fp1.setDefault(1.8500);
var fp2 = new FunctionParameter("Price2", FunctionParameter.NUMBER);
fp2.setName("Price < _____");
fp2.setLowerLimit(0);
fp2.setDefault(1.8500);
var fp3 = new FunctionParameter("Alert", FunctionParameter.STRING);
fp3.setName("Sound");
fp3.addOption( "On" );
fp3.addOption( "Off" );
fp3.setDefault("Off");
}
function main(Alert, Price1, Price2) {
if ( Alert == "On" && close() > Price1){
removeImage("PA1");
drawTextRelative(0, (high() + .0075), "Price Alert", Color.white, Color.red, Text.VCENTER|Text.CENTER, "Arial", 14, "PA1");
Alert.playSound("beam1.wav");
}
if ( Alert == "On" && close() < Price2){
removeImage("PA2");
drawTextRelative(0, (low() - .0075), "Price Alert", Color.white, Color.red, Text.VCENTER|Text.CENTER, "Arial", 14, "PA2");
Alert.playSound("beam1.wav");
}
If ( Alert == "Off");{
}
return
}
Comment