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

creating a simple indicator

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

    creating a simple indicator


    Good afternoon.
    I would like to help to create a simple indicator.
    It will not get information from the chart, it will just draw regions using fixed values that I will report daily.
    I will enter VAR1 and VAR2 and would like the indicator to draw the regions according to the formula result:

    x1 = var1 + (2.00 * var2);
    x2 = var1 + (2.5 * var2);
    x3 = var1- (2.00 * var2);
    x4 = var1- (2.5 * var2);

    x5 = var1 + (4.00 * var2);
    x6 = var1 + (4.5 * var2);
    x7 = var1- (4.00 * var2);
    x8 = var1- (4.5 * var2);

    Attached image of how I would like it to look on the chart.
    Thank you.

    #2
    Hello guigs88,

    Thanks for your post.

    You might want to look at a couple of indicators in the NT user app section (NinjaTrader Ecosystem website) that are free to download and use. The indicator "Repeater" would allow you to specify up to 10 events on a daily basis. One of the event types is a "price region" where you specify an upper and lower price (start and end) and the indicator will draw the region at the specified levels. The indicator can also do other things but thought you might want to check into it, here is a link: https://ninjatraderecosystem.com/use...load/repeater/

    Also, the indicator ColorZone3 may be a good starting point for creating your own if it does not meet your needs: https://ninjatraderecosystem.com/use.../colorzone3-2/

    Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Based on the indicators you sent me, I was able to do what I needed. Thank you!

      Comment


        #4
        Hello .. Good night.
        I am encountering the following error when I try to insert the indicator into the chart. Can you help me?

        2019-08-20 19:54:32:768 ERROR: Indicator 'ZONAS': Error on calling 'OnBarUpdate' method on bar 3: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

        Tks..
        Attached Files

        Comment


          #5
          Hello guigs88,

          Thanks for your reply.

          The particular error above indicates that the indicator is trying to access a bar that it has not loaded yet. The indicator will start on the very first historical bar and begin processing according to the code in your script. The error would occur if for example on bar number 3 you tried to access a value such as High[4] because the 4th bar would not be loaded. Typically this error would be resolved by checking to see if the CurrentBar being processed is greater than the farthest back bar being access, please see: https://ninjatrader.com/support/help...currentbar.htm

          You may need to use print statements to debug your script. Please see our debug tips here: https://ninjatrader.com/support/help...script_cod.htm

          Please note that we do not provide code writing or debugging services.

          Alternately, if you would like your indicator created for you, we can provide references to 3rd party programmers.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by guigs88 View Post
            Hello .. Good night.
            I am encountering the following error when I try to insert the indicator into the chart. Can you help me?

            2019-08-20 19:54:32:768 ERROR: Indicator 'ZONAS': Error on calling 'OnBarUpdate' method on bar 3: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

            Tks..
            In my attached image, there is an error with Values[63]. I counted your AddPlot and it looks like you are missing one. If you count from 0, I only count 62, so referencing 63 will throw an error.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            4 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            40 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            19 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Working...
            X