Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

simple indicator

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

    simple indicator

    Good morning, I need to create a simple indicator to draw a dot if six consecutive closing prices are higher / lower than the previous bar.

    can you give me a few pointers to create this indi??

    Thx

    #2
    Hello futuros,

    Thanks for your post.

    I would suggest using the Ninjascript wizard to create the indicator framework. Please see the help guide here: https://ninjatrader.com/support/help...?ns_wizard.htm

    Once you have run through the wizard, it will leave the code open in the Ninjascript editor.

    In the OnBarUpdate() you would need to create your logic for the 6 consecutive closes and when true, you can use the Draw.Dot() method: https://ninjatrader.com/support/help.../?draw_dot.htm

    Because you are looking at the last 6 bars at any time, you need to prevent a bar access error at the beginning of your code by preventing your code from running until it has loaded at least 6 bars (this is not the same as bars on the chart) You can do this by checking if the system bar counter (CurrentBar) is less than 6, like this:

    if (CurrentBar < 6) return; // do not process below this code line until 6 bars loaded.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X