Announcement

Collapse
No announcement yet.

Plot a dot

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

  • Plot a dot

    Hi,

    I am new to programming. May somebody help how to write a code to plot a dot on a price bar 30 bars back ?

    Any help is appreciated.

    Thank you

    fankc

  • #2
    you would want to use drawShapeRelative.. like this..

    drawShapeRelative(BarIndex, Price, Shape, URL, Color, Flags, Tagname)

    For example, if I wanted to draw a blue DOT 30 bars ago, I would use.

    drawShapeRelative(-30, low(-30), Shape.CIRCLE, "", Shape.ONTOP, "MyDot"+BarCounter);
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thank for your help. Really appreciate it.

      fankc

      Comment


      • #4
        How do you plot this dot on the indicator instead on the price bar ? Any idea?

        Comment


        • #5
          frankc,

          You would use mostly the same command as Brad showed. The only change would be to use the indicator value in place of the low(-30) parameter.

          For example, if you wanted to plot a dot on an ADX study that you assigned to variable vADX you would use

          drawShapeRelative(-30, vADX.getValue(-30), Shape.CIRCLE, "", Shape.ONTOP, "MyDot"+BarCounter);

          Steve

          Comment


          • #6
            I have using this efs http://forum.esignalcentral.com/atta...&postid=63513. How do I incorporate that as my programming language not really solid. Hope you can help me.

            Thank you for your help.

            Comment


            • #7
              fankc,

              The following efs is a modified version of the one you linked to.

              I added code on lines 68-76 to draw dots when the MACD crosses the Signal line.

              Steve
              Attached Files

              Comment


              • #8
                Thank you for your help.

                Really appreciate it.

                Just want to know how to plot just a dot on the macd 30 bars back ? I could not figure it out. Would you able to help?

                Thank you

                Comment


                • #9
                  Just set the first parameter to how many bars back you want to draw the dot. In your case -30. Then use the value for the study 30 bars back as the 2nd parameter.

                  Like this:
                  PHP Code:
                  drawShapeRelative(-30vMACD.getValue(MACDStudy.MACD, -30), Shape.CIRCLE""Color.limeShape.ONTOPgID++); 
                  Steve

                  Comment


                  • #10
                    I have tried your suggestion. Somehow it never plot a dot back 30 bars back. It's plot 34 bars back. Find it strange?

                    Also there is few dot back further the 34 bars. Since the program ask to plot just a dot, why there is so many dot ? Could not figure out. Maybe I lack programming skill.

                    Anyway, a very big thank you for your help.

                    Comment


                    • #11
                      If you left the if statements that detect crossing it would print a dot at each cross, but 30 bars back. If you have a dot 34 bars back, that would mean you have a cross 4 bars back.

                      It's printing multiple dots because you have multiple crosses.

                      If you want to print a single dot 30 bars back then use this without the if statements.
                      PHP Code:
                      drawShapeRelative(-30vMACD.getValue(MACDStudy.MACD, -30), Shape.CIRCLE""Color.limeShape.ONTOP0); 
                      The zero as the last parameter (the dot id) will cause other dots with that same id to be replace with the new dot. So each new bar it will move the dot.

                      Steve

                      Comment

                      Working...
                      X