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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      169 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      326 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      252 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      353 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      180 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X