Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    JesseNinjaTrader Customer Service

    Comment


      #3


      sandman

      Thanks Jesse

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Waxavi, Today, 02:10 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      13 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Waxavi, Today, 02:00 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by alifarahani, Today, 09:40 AM
      5 responses
      23 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by gentlebenthebear, Today, 01:30 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X