Announcement

Collapse
No announcement yet.

Drawing Lines in Advanced Charts Help Required

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

  • #16
    re: horizontal line

    just what I need, thank

    Comment


    • #17
      Support from a friend..

      Jason,

      I use a different structure for graphics control...

      As I may want to record a bar (in the past) that I may use over and over as a start point for my line drawing routines, I build a bar counter to control everything...

      PHP Code:
      var nLastRawTime 0;
      var 
      BarCount 0;

      function 
      main() {

        if (
      nLastRawTime != getValue("rawtime"0)) {
           
      BarCount += 1;
           
      nLastRawTime getValue("rawtime"0);
        }

      Now, with this information, all I have to do is record the "barcount" value for the bar where I want to start my lines, then run a simple calculation in my line drawing routines to adjust the line start as new bars arrive..

      PHP Code:
      var nLastRawTime 0;
      var 
      BarCount 0;
      var 
      LineStart null;
      var 
      LineLevel 0;

      function 
      main() {

        if (
      nLastRawTime != getValue("rawtime"0)) {
           
      BarCount += 1;
           
      nLastRawTime getValue("rawtime"0);
        }


        if (
      high() > high(-1)) {  //  just a sample for a condition of a line start
          
      LineStart BarCount;
          
      LineLevel high();
        }

        if (
      LineStart != null) {
         
      drawLineRelative( (LineStart-BarCount), LineLEvel 0LineLevelPS_SOLID1Color.blue"Line1");
        }


      This way, everything is calculated automatically for me and all I have to do is record the "barcount" value and the "LineLevel" value anytime I want it to change.

      If I did not want a "flat line", I would just record a second "LineEnd" and "LineEndLevel" - the calculations would be identical.

      Hope this helps.

      Brad
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment

      Working...
      X