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

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 GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by nandhumca, Yesterday, 03:41 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by The_Sec, Yesterday, 03:37 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by vecnopus, Today, 06:15 AM
    0 responses
    1 view
    0 likes
    Last Post vecnopus  
    Started by Aviram Y, Today, 05:29 AM
    0 responses
    5 views
    0 likes
    Last Post Aviram Y  
    Working...
    X