Hi,
I have a CCI Alert that beeps on each tick (which is driving me nuts) when the CCI is above 100 or below -100. I need help modifying the script so that the Alert beeps on each cross of the -+100. I would like the Alerts to beep on each cross not at the close of the bar as would be the case if I used "SetComputerOnClose".
Thank you for your help.
I have a CCI Alert that beeps on each tick (which is driving me nuts) when the CCI is above 100 or below -100. I need help modifying the script so that the Alert beeps on each cross of the -+100. I would like the Alerts to beep on each cross not at the close of the bar as would be the case if I used "SetComputerOnClose".
Thank you for your help.
PHP Code:
var vLastAlert = -1;
function preMain() {
setPriceStudy(true);
setStudyTitle("CCI Alert");
}
var bInit = false;
var wCCI = null;
function main() {
if (bInit == false) {
Symbol = getSymbol();
Interval1 = getInterval();
var vSymbol1 = Symbol+","+Interval1;
wCCI = cci(20,sym(vSymbol1));
bInit = true;
}
var gCCI = wCCI.getValue(0);
if (
gCCI == null
) return;
if (
gCCI > 100
)
onAction1();
else if (
gCCI < -100
)
onAction2();
return null;
}
function postMain() {
}
function onAction1() {
Alert.playSound("beep.wav");
vLastAlert = 1;
}
function onAction2() {
Alert.playSound("beep.wav");
vLastAlert = 2;
}
Comment