Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom indicator question

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

    Custom indicator question

    I'm working on creating a custom indicator for NinjaTrader 8, and I'm trying to implement a feature that draws a box around two bars whenever they share the same close and open price. Not having any luck no matter what i try to enter. I've been exploring the NinjaTrader API, but I'm unsure about the specific steps or code snippets needed for this functionality. Has anyone successfully implemented a similar feature or could provide guidance on how to achieve this within the NinjaTrader 8 platform? Any help or code examples would be greatly appreciated. Thanks!

    #2
    Hello tmullen614,

    Thanks for your post.

    A condition could be created that checks if the current Close price (Close[0]) is equal to the current Open price (Open[0]) and also check if the previous Close price (Close[1]) is equal to the previous Open price (Open[1]). The Draw.Rectangle() method would be called within that condition to draw a rectangle on the chart window.

    To have the rectangle drawn from the previous bar to the current bar, you could consider setting the startBarsAgo property to 1 and the endBarsAgo property to 0.

    See the help guide documentation below for more information and sample code.

    Close: https://ninjatrader.com/support/help.../nt8/close.htm
    Open: https://ninjatrader.com/support/helpGuides/nt8/open.htm
    Draw.Rectangle(): https://ninjatrader.com/support/help..._rectangle.htm

    Below is a link to a forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/foru...040#post786040

    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript:


    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our help guide first:


    And the MSDN (Microsft Developers Network) C# Language Reference.
    https://ninjatrader.com/support/help...erence_wip.htm​​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 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
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X