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

multi series data and the right bar index

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

    multi series data and the right bar index

    I have 2 additional time frames for the same instrument loaded.
    Index 0 - the main one is the chart loaded. can be anything
    Index 1 - Ticks if available, otherwise minutes
    Index 2 - 60 min relevant for my strategy logic

    I have Calculated = Calculate.OnEachTick (dont think it has an effect though)

    Q1) should I keep some order of loading the data based on resolution. the higher index has the higher granularity ?

    Q2) I am trying to calculate the Highs[2][1]

    if (BarsInProgress == 2 && IsFirstTickOfBar)
    HighofLastBar = Highs[2][1]

    But the problem is that only the Highs[2][0] gives me the right value. the Highs[2][1] gives me the value of 2 bars ago.

    what am I missing ?

    #2
    Hello dadarara,

    Thank you for the post.

    For your first question, this can depend on your trading goals for the most part. It can be helpful to stagger the series from largest to smallest, or the opposite way around depending on the effect you are trying to achieve. For example, plotting many changes would require a smaller granularity primary series but trading on a more granular series does not carry the same requirement as you can add a second series and use that.

    From your description, it is hard to say why the value is incorrect at that time but I do see you are using IsFirstTickOfBar and you noted you are using Calculate.OnEachTick but it didn't seem to have an effect. Are you currently running this in historical or real-time?

    The OnEachTick setting will not work historically so that would change the way this logic processes historically. In realtime you would see OnEachTick begin working. Knowing the specifics of the test you are asking about will help me understand what should be happening better.

    Can you also provide a specific example for primary that we can work through on this?

    I look forward to being of further assistance.


    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse

      I am checking it historically.
      So that means that IsFirstTickOfBar should have no effect , right ?
      So the IF statement above is the same as : if (BarsInProgress == 2) ????

      also, if this is Historical run, than it calculates on the bar close ? if so its understood why the index [2][1] is not working. it should be the [2][0] as this is at the end of the bar I am checking.

      I appreciate if you can confirm the above.

      Comment


        #4
        Hello dadarara,

        Yes, this property is only variable when the script can process OnEachTick or OnPriceChange. With historical data that is being calculated OnBarClose this would remain true. Using a print, in this case, will help to know what the condition should equate to and what values are being used.

        Your condition uses && in addition to historically IsFirstTickOfBar being true so you are essentially only checking if BarsInProgress == 2. In real-time or whenever the IsFirstTickOfBar property can toggle to false, you will see this condition become variable.

        Historically your script does use OnBarClose.

        In regard to why the BarsAgo is equating to that value, I would need a more specific example including the primary series to understand why that may be the case. On your end, you could utilize Prints or plotting to better visualize the data your script is using to understand this.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X