Announcement

Collapse
No announcement yet.

Drawing Shapes and ticki

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

  • Drawing Shapes and ticki

    Hi again,

    Chart set up: 135t ES Z3

    Trying to do: Draw a dot at the high (+.25) of a bar when $ticki>=22

    This is the code I wrote:

    function preMain() {
    setStudyTitle("tickidots");
    setPriceStudy(true);

    }
    var n=1
    function main() {

    //get $ticki value
    var thigh = high(0,"$ticki");

    //draw shape
    if (thigh >= 22) {
    drawShapeRelative(0,high(0)+.25,Shape.CIRCLE,null, Color.lime,Shape.ONTOP,"high"+n);
    n=n+1;
    }

    return;
    }

    I get "Loading Data" and nothing else on the chart.

    Any suggestions?
    Thanks
    Daniel Parker

  • #2
    Seems to work on a 1min chart, but not a tick chart.

    Hmmm....stumped....

    Comment


    • #3
      I think the documentation for drawshape is a little misleading, try this

      function preMain() {
      setStudyTitle("tickidots");
      setPriceStudy(true);

      }
      var n=1
      function main() {

      //get $ticki value
      var thigh = high(0,"$ticki");

      //draw shape
      if (thigh >= 22) {
      drawShapeRelative(0,high(0)+.25,Shape.CIRCLE,null, Color.lime,Shape.ONTOP);
      n=n+1;
      }

      return;
      }

      Comment


      • #4
        I ran the code this morning....

        Every bar gives me a ticki high and plots a dot! I know this is not the case in reality.

        One thing, ES updates every tick (135t chart), and the efs runs everytick, right?

        But $ticki only updates every 6 seconds or so, could this be part of the problem?

        Has anybody gotten this to work?

        Your help is much appreciated

        Comment


        • #5
          Hello dangparker,

          This routine will not work on a 135t interval because the 135t bars of $TICKI do not correspond with 135t bars of ES based on time. The formula should work fine on time-based intervals (i.e. 5 minutes, daily etc.).
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment


          • #6
            So is there a way (command, overlay, whatever), to get the current value of $ticki on a 135t ES chart?

            Thanks for your help,
            Daniel Parker

            Comment


            • #7
              Hello Daniel,

              There isn't a way to synchronize this overlay on historical data because we do not have access in EFS to historical time and sales data. The code example below will collect the $Ticki data in real time and should give you the result you need. Keep in mind that when you first apply this to your chart, you won't see any shapes drawn on the historical bars. From that point on it will collect and draw the shapes.

              PHP Code:
              function preMain() {
                  
              setStudyTitle("tickidots");
                  
              setPriceStudy(true);
                  
              setShowCursorLabel(false);


              var 
              tHigh null;
              var 
              tLow null;
              var 
              0;

              function 
              main() {
                  if (
              getCurrentBarIndex() != 0) return;

                  var 
              tLast close("$TICKI");
                  if (
              tLast == null) return;
                  
                  if (
              getBarState() == BARSTATE_NEWBAR) {
                      
              tHigh tLast;
                      
              tLow tLast;
                      
              += 1;
                  }
                  
                  
              tHigh Math.max(tHightLast);
                  
              tLow Math.min(tLowtLast);
                  
                  if (
              tHigh >= 22) {
                      
              drawShapeRelative(0,high(0)+.25,Shape.CIRCLE,null,Color.lime,Shape.ONTOP"high"+n);
                  } else {
                      
              removeShape("high"+n);
                  }

                  if (
              tLow <= -22) {
                      
              drawShapeRelative(0,low(0)-.25,Shape.CIRCLE,null,Color.red,Shape.ONTOP"low"+n);
                  } else {
                      
              removeShape("low"+n);
                  }

                  return;

              Jason K.
              Project Manager
              eSignal - an Interactive Data company

              EFS KnowledgeBase
              JavaScript for EFS Video Series
              EFS Beginner Tutorial Series
              EFS Glossary
              Custom EFS Development Policy

              New User Orientation

              Comment


              • #8
                Thanks for the coding help, I was able to figure out that ticki close (and not high or low) was what I needed to look for.

                Attached is the file I came up with, a bit cludgy buy it works (and moves the dot if the high pushes through the high on which the ticki dot formed (for the same bar).

                Hope it can be of help to someone.

                Thanks again for your excellent support

                Daniel Parker

                p.s. If someone comes up with a way to streamline my efs, feel free to post it back here
                Attached Files

                Comment

                Working...
                X