Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw command when Close hits channel

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

    Draw command when Close hits channel

    I have a simple High-Low channel based on Lin Regs. Now I'd like to have it draw a dot when it hits either the High or Low but it does not compile.

    protected override void OnBarUpdate()
    {

    // Checks to make sure we have at least 1 bar before continuing
    if (CurrentBar < 1)
    return;

    LRLow.Set(LinReg(Low, period)[0]);
    LRHi.Set(LinReg(High, period)[0]);
    LRClose.Set(LinReg(Close, period)[0]);

    if (Close[0] >= LinReg(High,period)[0])
    {
    DrawDot("tag1", true, 0, High[0] + 2 TickSize, Color.Red);
    }

    if (Close[0] <= LinReg(Low,period)[0])
    {
    DrawDot("tag2", true, 0, Low[0] - 2 TickSize, Color.Green);
    }
    }

    An image of the code is also attached. I have looked over the {} and [] and ":" ad nauseum but can't find what I am doing wrong. Any help/advice?

    sandman
    Attached Files

    #2
    Hello,

    Please change the following syntax in both places it is used:

    Code:
    2 TickSize
    to

    Code:
    2 * TickSize
    If you want 2 Ticks, you would multiply two Times TickSize, the operator is missing from the syntax you are using currently.

    In the image, you can see the "Hint" or red line under TickSize, this indicates the error may be near what is currently Red Underlined. It is not 100% accurate but should give you a general idea on where the actual error is. As shown the error message does not say TickSize at all, but only that the structure of the file is incorrect.



    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 07-28-2016, 03:30 PM. Reason: added error description

    Comment


      #3


      sandman

      Thanks Jesse

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X