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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    57 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    78 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    39 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    101 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    61 views
    0 likes
    Last Post PaulMohn  
    Working...
    X