Announcement

Collapse
No announcement yet.

Line Drawing

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

  • Line Drawing

    Hi Alex, your "Line at Time x" is working great! I want to have more lines drawn using this line as a base:

    Once "line at time x" is drawn, to draw horiz lines above and below. I can do this manually with lineslabels.efs but I must input the actual prices. I only want to specify +/- increments with a maximum value, vs the "line at time x".

    Examp: if "line at time x" is drawn at 20.00 and I specifiy increments of (+/-).50 with a maximum value of (+/-)2.00, the hi lines are drawn at 20.50, 21.00, 21.50 and 22.00; the lo lines are drawn at 19.50, 19.00, 18.50 and 18.00.

    Are there exisiting studies which could be modified to do this, i.e. lineslabels(vs 2.0), roundnumberlines, srlines(1-2)? I really appreciate your time and expertise. Thanks again. Steve

  • #2
    Steve
    The attached revision of the efs adds parallel lines at +/- 0.5 from the Line at Time X. The script includes comments showing what needs to be done to plot more lines at +/-1.0, +/-1.5, etc.
    At this point you should have enough examples and information available to you to modify the efs to your requirements
    Alex

    Attached Files

    Comment


    • #3
      Hi Alex, thanks for the revised formula for Line at Time x(2). Your instructions for additioinal values were perfect and I've added what I need.

      Is there a way to change the first line's color so that it's a different color from all the other lines? So, there would be two colors: one for the first line, and one different color for all the others. I played around with the code along with tech support but couldn't get it to work.

      Thanks again for all your help.

      Steve

      Comment


      • #4
        Steve
        In line 53 replace vColor with Color.yourcolor where yourcolor is any one of the colors defined here (for example Color.red)
        Alex

        Comment


        • #5
          Alex,
          That worked perfectly. I now have one line at a specified time with one color, and other incremental lines above/below it with their own colors. This is saving me a lot of time particularly in early morning trading. Thanks a ton!

          Is there any way to create an alert based on the lines created in lineattimex(2)? So, when a bar hits/passes a line it triggers an alert. Again, this would save time vs right clicking on a chart to set alerts as we can now do with 7.7.

          I really do appreciate the time you've given me and if I can get my alerts squared away it should hold me for awhile.

          Steve

          Comment


          • #6
            Steve
            The attached revision of the efs now includes sound alerts for the +/- 0.5 levels from Line at X.
            The alerts will sound only one ding each time price cross above/below these levels.
            Alex
            Attached Files

            Comment


            • #7
              Hi Alex, your latest update on lineattimex(2)(alerts) is working great! The alerts are triggered each time a bar hits a line and I can determine if it's a hi/lo by different sounds.

              Is there any way to get a visual ID on which chart is alerting, i.e. a small popup window? I use about 20 chart windows at the same time (one for ea stock) and I can only view 6 at once so I can see what's alerting on those, but the others are open and minimized so I can't see which one of those are alerting.

              I'd appreciate your ideas, thanks.

              Steve

              Comment


              • #8
                smart1
                Just add an Alert.addToList() command under the same conditions.
                For the syntax see this article in the EFS KnowledgeBase
                Alex

                Comment


                • #9
                  Hi Alex, I do a lot of charting with Bollinger Bands and discovered one you wrote called builtinbb(alert) from 10/03. I changed the colors and sounds and it didn't work. There were no syntax errors. The only code I noticed that is different from the one you recently provided me (lineattimex) is....+get Interval().
                  Is there something I need to change i.e "+get Interval()", is there a conflict with vs 7.7 or am I just screwing up?

                  P.S. Since your builtinbb(alert) is coded to alert and display, I will only use the line drawing codes for your lineattimex(2) if I decide to run that simultaneously.

                  Thanks again,

                  Steve

                  Comment


                  • #10
                    Steve
                    Without seeing either script I do not know what you are referring to. Was the builtinbb(alert) from October 2003 or October 3rd of this year? Actually it would be better if you could provide a link to it and at the same time post the code which is not working. As far as I know there are no conflicts with 7.7
                    Alex

                    Comment


                    • #11
                      Hi Alex, your study called builtinbb(alert) was from Oct 2003. There are others i.e. bbof _template, betterbb, bbhirange,
                      basic BB. Which ones are best for the following:

                      I need Hi/Lo audio and popup alerts if:
                      upper and lower Boll Bands pinch =<.05 from middle band, and;
                      Next bar high hits or passes upper/lower BB.

                      Again, your expertise is greatly appreciated. Thanks.

                      Steve

                      Comment


                      • #12
                        Steve
                        It would be best at this point if you post the code that you have been working on so that I can look it over.
                        Alex

                        Comment


                        • #13
                          Hi Alex, here's your study builtinbb(alert). I made modifications: when a bar's high hits the upper band it alerts; when a bar's low hits the lower band it alerts. The low alerts work fine, the highs don't work at all. Tech Support thinks there's a bug so plz help.

                          If this can be fixed I need new alert criteria: 1. when upper or lower BB "pinch" to within .05 of the middle band (=<.05), and if
                          2. the next bar's high/low hits the upper/lower BB, then alert is triggered.

                          Thanks again Alex.

                          [code]/************************************************** *******
                          Alexis C. Montenegro © October 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 vBB = null;

                          function preMain() {
                          setPriceStudy(true);
                          setStudyTitle("BollingerBand");
                          setCursorLabelName("BB-Upr", 0);
                          setCursorLabelName("BB-Bas", 1);
                          setCursorLabelName("BB-Lwr", 2);
                          setDefaultBarFgColor(Color.blue, 0);
                          setDefaultBarFgColor(Color.aqua, 1);
                          setDefaultBarFgColor(Color.blue, 2);
                          setDefaultBarThickness(1,0);
                          setDefaultBarThickness(1,1);
                          setDefaultBarThickness(1,2);

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

                          var fp2 = new FunctionParameter("StdDev", FunctionParameter.NUMBER);
                          fp2.setLowerLimit(0);
                          fp2.setDefault(2); //Edit this value to set a new default

                          var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
                          fp3.setName("Source");
                          fp3.addOption("Close");
                          fp3.addOption("High");
                          fp3.addOption("Low");
                          fp3.addOption("Open");
                          fp3.addOption("HL/2");
                          fp3.addOption("HLC/3");
                          fp3.addOption("OHLC/4");
                          fp3.setDefault("High"); //Edit this value to set a new default

                          var fp4= new FunctionParameter("Value", FunctionParameter.NUMBER);
                          fp4.setDefault(1); //Edit this value to set a new default

                          }

                          function main(Length, StdDev, Source, Value) {

                          if (vBB == null) vBB = new BollingerStudy(Length, Source, StdDev);

                          /*************************************************
                          Insert your code following this text block
                          Use vBB.getValue(BollingerStudy.UPPER) and
                          vBB.getValue(BollingerStudy.BASIS) and
                          vBB.getValue(BollingerStudy.LOWER) for your code
                          **************************************************/

                          if(getBarState()==BARSTATE_NEWBAR) {
                          if(high(-2)<vBB.getValue(BollingerStudy.UPPER,-2)&&high(-1)>vBB.getValue(BollingerStudy.UPPER,-1)){
                          Alert.playSound("ding.wav");
                          Alert.addToList(getSymbol()+" "+getInterval(), Color.black,Color.green);
                          }
                          if(low(-2)>vBB.getValue(BollingerStudy.LOWER,-2)&&low(-1)<vBB.getValue(BollingerStudy.LOWER,-1)){
                          Alert.playSound("stone1.wav");
                          Alert.addToList(getSymbol()+" "+getInterval(), Color.black,Color.red);
                          }
                          }

                          return new Array (vBB.getValue(BollingerStudy.UPPER),vBB.getValue(B ollingerStudy.BASIS),vBB.getValue(BollingerStudy.L OWER));
                          }
                          [\code]

                          Comment


                          • #14
                            Steve
                            There is no bug. The High never crosses the Upper BB and therefore never triggers an alert. This is due to a combination of the BB being calculated on the High (see the default value for Source in Function Parameter 3) and the very short Length. Change the Source to Close, HL/2, etc and you will see that the efs works fine.
                            Attached is a revision of the efs that includes the additional conditions. Also included in the script are comments explaining the logic.
                            With this revision and with the other efs that trigger alerts available in these forums you should have at this point enough examples and information to modify this efs to your requirements.
                            Alex
                            Attached Files

                            Comment


                            • #15
                              Hi Alex, you were absolutely right and my sound and popup alerts worked fine. I would like to make a small change that I've been unable to do on lines 81-82 for the "high" values:

                              On line 81 it's not necessary for me to keep the prior high < prior Upper BB. Unless that's required for the formula to work and trigger the alerts, it can be deleted. What I need at the .05 pinch is the current high >= current Upper BB (AND) the next high >= next Upper BB (AND) the same alerts. In other words I want the .05 pinch and 2 consecutive highs hitting their corresponding Upper BB, then the alert. How can this be written?

                              Also, if I decide not to use the "low" values I presume the lines 89-95 are to be deleted and also the vBB.getValue(BollStudy.LOWER) on line 98. Is that correct?

                              I've attached your builtinbb(smart1-alerts). If it doesn't come through it's hyperlinked on your last reply. Thanks again Alex.

                              Comment

                              Working...
                              X