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.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by WalterSkinner, Yesterday, 02:37 PM
    3 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by Fer123, Yesterday, 04:57 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by Cormick, Today, 06:26 AM
    0 responses
    4 views
    0 likes
    Last Post Cormick
    by Cormick
     
    Started by torch2k, Today, 06:24 AM
    0 responses
    5 views
    0 likes
    Last Post torch2k
    by torch2k
     
    Started by Devside_Victor, Today, 04:57 AM
    0 responses
    1 view
    0 likes
    Last Post Devside_Victor  
    Working...
    X