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

Reading volume information from Indicator

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

    Reading volume information from Indicator

    Hello
    Question: how I can read current volume value from Indicator sbClusterChart to my Strategy?
    Do you have any idea?


    #2
    Hello

    Thank you for the post.

    While it is possible for a strategy to request data from a indicators plot, this would ultimately depend if the indicator exposes that data. For this item, you would likely need to contact the developer of this indicator to find out if they have exposed the data you want as a plot. If so, you could certainly request that data from a strategy. You would likely also need to ask the developer of this item if any special syntax is required to call this indicator from a strategy,

    There can be certain cases where a developer does not expose the data and in that case you may not be able to access it.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesss for you answer!

      I have error in Log when I try to read any info from indicators with Tickreplay setting ON
      Error "Strategy 'MyCustomStrategy': Error on calling 'OnBarUpdate' method on bar 1: Index was outside the bounds of the array."

      How I can fix it?
      Thanks a lot

      Comment


        #4
        Hello sergey_z,

        Thank you for the reply.

        This would depend if you are running into a BarsAgo error, or an index in a collection being used. If the following instructions do not help, please provide a sample of the strategy for me to review and we could gather more details on what may be causing the error.

        Generally, this can be resolved by adding a check to prevent the script from processing until you have enough data. How much is enough data? A number of bars you are looking back is what would be required, so let's say that you have a 1 BarsAgo in your script: Close[1]
        You would need a check like the following:

        Code:
        protected override void OnBarUpdate()
        {
            [B]if(CurrentBar < 1) return;[/B]
            Print(Close[1]);
        }
        This would just check if there is at least 1 bar, if so then continue the logic otherwise do nothing until this is true.

        You would also need some check like this, depending on the BarsAgo you look back you could change the 1 in the example to that number.

        This can also be the case with other collections you use, it would really depend on what specific syntax is being used. Keep in mind that TIck Replay does change the way the script calls OnBarUpdate so if you are using specific indexes, you may need to check if that index exists in the collection being used before trying to use it.

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 03-15-2017, 07:16 AM.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        0 responses
        2 views
        0 likes
        Last Post alifarahani  
        Started by Gerik, Today, 09:40 AM
        0 responses
        1 view
        0 likes
        Last Post Gerik
        by Gerik
         
        Started by RookieTrader, Today, 09:37 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by KennyK, 05-29-2017, 02:02 AM
        3 responses
        1,282 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by AttiM, 02-14-2024, 05:20 PM
        11 responses
        184 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X