Announcement

Collapse
No announcement yet.

tics counter sound problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tics counter sound problem

    I use this Efs to make the countdown of the remaining tics in tics chart, when go in "ticalert" limit setted may play a sound.
    this work in TIcs frame correctly but non in vol chart, no sound on vol chart , if I change the chart in tics chart again , sound good.
    anyone know where is the problem ?
    thank you in advance

    var nLastRawTime;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("TICS counter");
    setCursorLabelName("TICS counter");
    setShowCursorLabel(true);

    var fp1 = new FunctionParameter("Trigger", FunctionParameter.NUMBER);
    fp1.setLowerLimit(0);
    fp1.setDefault(50);

    var fp2 = new FunctionParameter("Ticalert", FunctionParameter.NUMBER);
    fp2.setLowerLimit(0);
    fp2.setDefault(50);
    }

    var y = 0;

    function main(Trigger,Ticalert) {

    if(isRawTick()!=true||isTick()==true)
    return;

    var x = getInterval();
    var n = parseInt(x);

    if(1==1)
    y += 1;
    if(getBarState()==BARSTATE_NEWBAR){
    y=1;
    }
    var z = n-y;

    if(z<Trigger){
    setBarFgColor(Color.red);
    drawTextRelative(3,close(),z,Color.red,null,Text.B OLD|Text.VCENTER,"Arial",12,"TIB");


    }else{
    setBarFgColor(Color.blue);
    drawTextRelative(3,close(),z,Color.white,null,Text .BOLD|Text.VCENTER,"Arial",12,"TIB");
    }
    if(z<Ticalert){
    Alert.playSound("ticalert.wav");


    return z+" ";

    }

  • #2
    o.marco73
    I already provided a solution in response to a similar question in this thread which - by the way - is where the formula you posted originates from
    Alex


    Originally posted by o.marco73 View Post
    I use this Efs to make the countdown of the remaining tics in tics chart, when go in "ticalert" limit setted may play a sound.
    this work in TIcs frame correctly but non in vol chart, no sound on vol chart , if I change the chart in tics chart again , sound good.
    anyone know where is the problem ?
    thank you in advance

    var nLastRawTime;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("TICS counter");
    setCursorLabelName("TICS counter");
    setShowCursorLabel(true);

    var fp1 = new FunctionParameter("Trigger", FunctionParameter.NUMBER);
    fp1.setLowerLimit(0);
    fp1.setDefault(50);

    var fp2 = new FunctionParameter("Ticalert", FunctionParameter.NUMBER);
    fp2.setLowerLimit(0);
    fp2.setDefault(50);
    }

    var y = 0;

    function main(Trigger,Ticalert) {

    if(isRawTick()!=true||isTick()==true)
    return;

    var x = getInterval();
    var n = parseInt(x);

    if(1==1)
    y += 1;
    if(getBarState()==BARSTATE_NEWBAR){
    y=1;
    }
    var z = n-y;

    if(z<Trigger){
    setBarFgColor(Color.red);
    drawTextRelative(3,close(),z,Color.red,null,Text.B OLD|Text.VCENTER,"Arial",12,"TIB");


    }else{
    setBarFgColor(Color.blue);
    drawTextRelative(3,close(),z,Color.white,null,Text .BOLD|Text.VCENTER,"Arial",12,"TIB");
    }
    if(z<Ticalert){
    Alert.playSound("ticalert.wav");


    return z+" ";

    }

    Comment

    Working...
    X