Announcement

Collapse
No announcement yet.

drawLineAbsolute

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

  • drawLineAbsolute

    drawLineAbsolute(0, xStochKH.getValue(0), 0, xStochKL.getValue(0), PS_SOLID, 1, Color.RGB(0,0,255), count) doesn't seem to work, but debugPrintln( xStochKH.getValue(0)+" "+xStochKL.getValue(0)+" "+count ) ; and return new Array ( xStochKH.getValue(0), xStochKL.getValue(0)); do.

    Am I missing something?

  • #2
    Re: drawLineAbsolute

    David
    In what way is it not working? I tried it at my end and it appears to be drawing the line [or more appropriately lines] correctly
    Alex


    Originally posted by dloomis
    drawLineAbsolute(0, xStochKH.getValue(0), 0, xStochKL.getValue(0), PS_SOLID, 1, Color.RGB(0,0,255), count) doesn't seem to work, but debugPrintln( xStochKH.getValue(0)+" "+xStochKL.getValue(0)+" "+count ) ; and return new Array ( xStochKH.getValue(0), xStochKL.getValue(0)); do.

    Am I missing something?

    Comment


    • #3
      The only line that draws is one at the end, from 0 to 100.

      Usually that means I am not 'tagging' the line properly, but count is incrementing in the debugPrintln statement.
      Attached Files

      Comment


      • #4
        David
        The reason why you are seeing a line from 0 to 100 is because that is one of the many lines you are drawing at the absolute bar index 0 as the formula is executing on historical bars
        You only see one line because they are all located on the same bar index 0.
        Try replacing the tagID count with [for example] "line" and you will see that only one line will be drawn between those two values
        Alternatively replace drawLineAbsolute() with drawLineRelative() and you will see a line on each bar between the corresponding values
        Alex


        Originally posted by dloomis
        The only line that draws is one at the end, from 0 to 100.

        Usually that means I am not 'tagging' the line properly, but count is incrementing in the debugPrintln statement.

        Comment


        • #5
          I see, thanks, how do i get the historical lines to draw for bars -1 thru -100.

          Thanks again.
          Attached Files

          Comment


          • #6
            David
            You could do that in the following way
            Alex

            PHP Code:
            if(getBarState()==BARSTATE_NEWBARcount++;
                if(
            count>100count 0;
                
                
            drawLineRelative(0xStochKH.getValue(0), 0xStochKL.getValue(0), PS_SOLID1Color.RGB(0,0,255), count); 


            Originally posted by dloomis
            I see, thanks, how do i get the historical lines to draw for bars -1 thru -100.

            Thanks again.

            Comment


            • #7
              I got the same results with your suggestion so I ended up using a 'for' loop from 1 to 100, using -i instead of 0, works fine,

              if(getBarState()==BARSTATE_NEWBAR) {count++;
              //debugPrintln( xStochKH.getValue(0)+" "+xStochKL.getValue(0)+" "+count ) ;
              for ( i = 0 ; i <100 ; i++ ) {
              drawLineAbsolute(-i, xStochKH.getValue(-i), -i, xStochKL.getValue(-i), PS_SOLID, 1, Color.RGB(0,0,255), i)
              } }

              I bet it works lousy real time tho, we will see.
              Attached Files

              Comment


              • #8
                David
                Did you also replace drawLineAbsolute() with drawLineRelative()?
                As far as I can see at my end my suggestion is drawing only the lines on the most recent 100 bars
                Alex


                Originally posted by dloomis
                I got the same results with your suggestion so I ended up using a 'for' loop from 1 to 100, using -i instead of 0, works fine,

                if(getBarState()==BARSTATE_NEWBAR) {count++;
                //debugPrintln( xStochKH.getValue(0)+" "+xStochKL.getValue(0)+" "+count ) ;
                for ( i = 0 ; i <100 ; i++ ) {
                drawLineAbsolute(-i, xStochKH.getValue(-i), -i, xStochKL.getValue(-i), PS_SOLID, 1, Color.RGB(0,0,255), i)
                } }

                I bet it works lousy real time tho, we will see.

                Comment


                • #9
                  David
                  Here is what I am seeing using my suggestion
                  Alex

                  Comment


                  • #10
                    I got it now, for some reason when i changed the return statement from

                    return null;

                    to return new Array (...)

                    and then back it worked.

                    Before that, nada.

                    Your Dockers are in the mail buddy! Thanks!

                    Comment


                    • #11
                      David
                      You are most welcome (and you can still keep the Dockers...)
                      Alex


                      Originally posted by dloomis
                      I got it now, for some reason when i changed the return statement from

                      return null;

                      to return new Array (...)

                      and then back it worked.

                      Before that, nada.

                      Your Dockers are in the mail buddy! Thanks!

                      Comment

                      Working...
                      X