Announcement

Collapse
No announcement yet.

V count indicator

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

  • V count indicator

    I'm trying to use a V countdown indicator in the non price study and would like it to be centered in the lower pane instead of the diplay at top, can any one suggest changes I need to do to accomplish this task

    Peter
    Attached Files

  • #2
    I'm not sure this is what you are looking for but try this.

    PHP Code:
    /*********************************************************
    By Alexis C. Montenegro for eSignal © December 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.                      
    **********************************************************/
    debugClear();
    function 
    preMain() {
        
    setPriceStudy(false);
        
    setStudyTitle("V-Count2");
        
    setCursorLabelName("V-Count");
        
    setShowCursorLabel(true);      
        
    setStudyMax); 
        
    setStudyMin( -); 
    }
     
    function 
    main() {
     
        var 
    getInterval();
        var 
    parseInt(x);
         var 
    n-volume(0);
     
        
    drawTextRelative(2,0,z,Color.cyan,null,Text.BOLD|Text.VCENTER,"Arial",16,"TVB");
     
    //    return z.toFixed();

    Comment


    • #3
      thanx Wayne, thats perfect

      Comment


      • #4
        Wayne, I'm trying to add alert to play sound when counter hits 10 for the same script. Which part of this script can I use to accomplish the alert

        Peter
        Attached Files

        Comment


        • #5
          Peter
          See my reply in this thread in response to a similar question on the same script
          Alex


          Originally posted by luvette
          Wayne, I'm trying to add alert to play sound when counter hits 10 for the same script. Which part of this script can I use to accomplish the alert

          Peter

          Comment


          • #6
            thanx Alex for your help got the alert working, I'm also trying to get the counter to flash on / off once alert is set and could use help on how to accomplish that as well
            Peter

            Comment


            • #7
              Peter
              You are welcome.
              As to flashing on and off the counter try searching the forum as I believe JasonK already posted a complete example that illustrates how to accomplish this and that you can adapt to your script
              Alex


              Originally posted by luvette
              thanx Alex for your help got the alert working, I'm also trying to get the counter to flash on / off once alert is set and could use help on how to accomplish that as well
              Peter

              Comment


              • #8
                Alex, I found that changing the color when alert goes off will be equally helpful. I add the following to change color but with no success, do I need to add another line of code, obviously the script isn't correct.

                Peter
                Attached Files

                Comment


                • #9
                  Hi Peter,

                  I am sure that Alex can solve this issue but I see a few errors in your code that if fixed can help. The syntax of the drawTextRelative statement in your code does not appear to be correct. The subtax is supposed to be:

                  drawTextRelative( barIndex, yValue, text, fgColor, bgColor, Flags, fontName, fontSize [, tagID] [, cx] [, cy] )

                  In your code your first parameter, the bar index, is 2. So you are drawing two bars ahead (in the future) of the current bar. I am not sure if that is what you want. If you are looking to draw 2 bars back of the current bar than the number should be -2.

                  Nest parameter you have is close(). That should be close(0) for the current bar close or close of some n bars back; i.e. close (-n).

                  Your next parameter is z. You define z as a number but the drawTextRelative requires that the third parameter is to be text. Perhaps you want to convert z to text; for example use z.toString() or simply "z" in this position.

                  I hope this helps a little.
                  Regards,
                  Jane


                  Originally posted by luvette
                  Alex, I found that changing the color when alert goes off will be equally helpful. I add the following to change color but with no success, do I need to add another line of code, obviously the script isn't correct.

                  Peter

                  Comment


                  • #10
                    Jane
                    thanx, the script works well but I'm trying to change color of counter when it is less then set value for alert and not sure how to get that done.
                    Peter

                    Comment


                    • #11
                      I got it working, thanx for the help.
                      Peter
                      Attached Files

                      Comment


                      • #12
                        Hi Peter,

                        Great! Please note that you don't need the if(z > 13) in the first draw stament.
                        Regards,
                        Jane

                        Originally posted by luvette
                        I got it working, thanx for the help.
                        Peter

                        Comment


                        • #13
                          Jane without it the counter doesn't change color, atleast on my end... but none the less it works. This one plots in non price study
                          Attached Files

                          Comment


                          • #14
                            Hi Peter,

                            Just a slight correction to the last condition of both scripts. Please see below:

                            v_count2.efs
                            PHP Code:
                            /*********************************************************
                            By Alexis C. Montenegro for eSignal © December 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.                      
                             **********************************************************/
                             
                            debugClear();
                            function 
                            preMain() {
                                
                            setPriceStudy(false);
                                
                            setStudyTitle("V-Count2");
                                
                            setCursorLabelName("V-Count");
                                
                            setShowCursorLabel(false);      
                                
                            setStudyMax); 
                                
                            setStudyMin( -); 
                            }
                             
                            function 
                            main() {
                             
                                var 
                            getInterval();
                                var 
                            parseInt(x);
                                 var 
                            n-volume(0);
                             
                                if (
                            15 drawTextRelative(2,0,z,Color.cyan,null,Text.BOLD|Text.VCENTER,"Arial",16,"TVB");
                                if (
                            15 ){ 
                                    
                            drawTextRelative(2,0,z,Color.red,null,Text.BOLD|Text.VCENTER,"Arial",16,"TVB");
                                    
                            Alert.playSound("bullet.wav"); 
                                }
                            //    return z.toFixed();

                            VOLCOUNTDOWNALERT.EFS
                            PHP Code:
                            /***********************************
                            Alexis C. Montenegro © February 2004
                            ************************************/


                            function preMain() {
                                
                            setPriceStudy(true);
                                
                            setStudyTitle("Vol Countdown");
                                
                            setCursorLabelName("Vol Countdown");
                                
                            setShowCursorLabel(false)      
                            }
                             
                            function 
                            main() {
                             
                                var 
                            getInterval();
                                var 
                            parseInt(x);
                             
                                var 
                            n-volume(0);
                             
                                if(
                            13drawTextRelative(2,close(),z,Color.cyan,null,Text.BOLD|Text.VCENTER,"Arial",16,"TVB");
                                if(
                            13){
                                    
                            drawTextRelative(2,close(),z,Color.red,null,Text.BOLD|Text.VCENTER,"Arial",16,"TVB");
                                    
                            Alert.playSound("buzz.wav");
                                }

                                return 
                            z+" ";

                            Wayne

                            Comment

                            Working...
                            X