Announcement

Collapse
No announcement yet.

60 tick chart audio alert help

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

  • 60 tick chart audio alert help

    I am currently using a 60-tick bar chart for the Russell E-Mini (AB). I am wondering if there is an audio alert that is generated when every tick bar is formed. That is, when a 60-tick bar, corresponding to 60 trades, is generated, you can get an audio alert. The reason is that when there is a good volume being traded i.e. more bars being generated, I want to get a rapid audio alert for the formation each bar.

    Thank you for you assistance.

  • #2
    ahb
    I believe the enclosed script will do that
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("New Bar Alert");
        
    setShowCursorLabel(false);
          
    }
    function 
    main() {

    if(
    getBarState()==BARSTATE_NEWBAR){
    Alert.playSound("ding.wav");
    }

    return;

    Comment


    • #3
      Re: 60 tick chart audio alert

      Dear Alex:

      Thank you very much for the script.
      However, how can I add that to the chart? I typed the script in the exact way in the EFS editor and saved it as an .efs file in the Formula folder. I have pulled it up on the chart and it appears as a separate window on the bottom. However, it does not seem to be working! Did I do the setup correctly?

      Again, many many thanks for your help.

      Cheers,
      AHB

      Comment


      • #4
        AHB
        Copy only the part that is contained inside the php box. Then open a new window in the Editor (Tools->EFS->Editor) and Paste the contents in there. Save the file without adding an efs extension (it will be automatically added for you) in the Formulas folder or any one of its subfolders.
        Alex

        Comment


        • #5
          Dear Alex:

          Thank you very much for all your help. The script works perfectly!

          Kind regards,
          AHB

          Comment


          • #6
            Tick Alert

            Alex:

            Would it be possible to set the alert to sound when a certain number of ticks have passed? For example - the alert sounds when 180 ticks have passed? I am using a 195 tick chart, and want advanced warning that the bar is about to close. Thanks for your consideration...

            Steve

            Comment


            • #7
              Steve
              If I remember correctly I already wrote a script that does that. Try running a search for my user name and tick count* or something to that order.
              Alex

              Comment


              • #8
                Tick Alerts

                Alex:

                I thought so also. I found one that does price and volume, but not ticks. Is is possible to add "ticks" as a choice when viewing it under edit studies? Thanks for your help!

                /************************************************** *******
                Alexis C. Montenegro © May 2003
                Use and/or modify this code freely. If you redistribute it
                please include this and/or any other comment blocks and a
                description of any changes you make.
                ************************************************** ********/

                var nLastRawTime1;
                var nLastRawTime2;

                function preMain() {

                setPriceStudy(false);
                setStudyTitle("Bar Close Alert");
                setCursorLabelName("Vol", 0);
                setCursorLabelName("maVol", 1);
                setDefaultBarStyle(PS_SOLID, 0);
                setDefaultBarStyle(PS_SOLID, 1);
                setDefaultBarFgColor(Color.black, 0);
                setDefaultBarFgColor(Color.black, 1);
                setDefaultBarThickness(1, 0);
                setDefaultBarThickness(1, 1);
                setPlotType(PLOTTYPE_HISTOGRAM, 0);
                setPlotType(PLOTTYPE_LINE, 1);
                setColorPriceBars(false);


                var fp1 = new FunctionParameter("MALength", FunctionParameter.NUMBER);
                fp1.setLowerLimit(1);
                fp1.setDefault(30);//Edit this value to set a new default

                var fp2 = new FunctionParameter("Threshold", FunctionParameter.NUMBER);
                fp2.setDefault(2000);//Edit this value to set a new default

                var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
                fp3.addOption("Price");
                fp3.addOption("Volume");
                fp3.setDefault("Volume"); //Edit this value to set a new default

                }

                function main(MALength,Threshold,Source) {

                var nLength = MALength;
                var i;
                var vSum = 0.0;
                var vValue;

                vValue = volume(0, -nLength);

                if(vValue == null) {
                return;
                }

                for(i = 0; i < nLength; i++) {
                vSum += vValue[i];
                }
                var MAofVol = Math.round(vSum/nLength);

                if(Source=="Price"){
                if (close() < close(-1))
                setBarFgColor(Color.RGB(255,0,0));
                else if (close() > close(-1))
                setBarFgColor(Color.RGB(0,0,255));
                else if (close() == close(-1))
                setBarFgColor(Color.RGB(0,0,0));
                }
                if(Source=="Volume"){
                if (volume() < volume(-1))
                setBarFgColor(Color.RGB(255,0,0));
                else if (volume() > volume(-1))
                setBarFgColor(Color.RGB(0,0,255));
                else if (volume() == volume(-1))
                setBarFgColor(Color.RGB(0,0,0));
                }


                if (getValue("rawtime",0) != nLastRawTime1) {
                if(volume()>MAofVol){
                Alert.playSound("ding.wav");
                nLastRawTime1 = getValue("rawtime",0);
                }
                }
                if (getValue("rawtime",0) != nLastRawTime2) {
                if(volume()>Threshold){
                Alert.playSound("1500 Volume.wav");
                nLastRawTime2 = getValue("rawtime",0);
                }
                }

                return new Array (volume(),MAofVol);

                }

                Comment


                • #9
                  Steve
                  This efs plots Volume and computes its average. The "Price" and "Volume" options refer only to the method used to color the Volume bar.
                  As I said run a search for tick or tick count* or similar for my user name and you should find the efs I am referring to.
                  Alex

                  Comment


                  • #10
                    Tick Counter

                    Alex:

                    That alert works well as a counter if you set the MALength to "1", and the threshold to "5" ticks (volume as it is currently written) before the bar ends. If you could substitute ticks it would be perfect. I did the search you suggested, and I came up with Tib Counter...but that one counts down backwards, and uses a pop up alert instead of a sound. Tib Counter is copied below. Any ideas? Thanks...

                    /************************************************** *******
                    Alexis C. Montenegro © February 2004
                    Use and/or modify this code freely. If you redistribute it
                    please include this and/or any other comment blocks and a
                    description of any changes you make.
                    ************************************************** ********/

                    var nLastRawTime;

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

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

                    var y = 0;

                    function main(Trigger) {

                    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 (getValue("rawtime",0) != nLastRawTime) {
                    if(z<Trigger){
                    Alert.addToList(getSymbol()+" "+getInterval(),"Tick Counter Alert",Color.black,Color.red);
                    //Alert.playSound("ding.wav");
                    nLastRawTime = getValue("rawtime",0);
                    }
                    }

                    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.blue,null,Text. BOLD|Text.VCENTER,"Arial",12,"TIB");
                    }

                    return z+" ";
                    }

                    Comment


                    • #11
                      Steve
                      In the last script you posted replace z = n-y; with z = y; and replace if(z<Trigger){ with if(z==Trigger){
                      Lastly remove the // at the beginning of the line //Alert.playSound("ding.wav");
                      These changes will make the script count forwards and trigger a sound alert at the number of ticks set in Edit Studies.
                      Alex

                      Comment


                      • #12
                        Tick Alert

                        Works perfectly. Thanks Alex!

                        Comment

                        Working...
                        X