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

output H L O C data issues....

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

    output H L O C data issues....

    I have a rather extensive indicator that uses H L O C data in it's calculations.

    It is a multi dataframe indicator. ( for example 5min and 10min) It also runs so that all trades are processed by the code (Calculate on bar close = False)

    The graphing/ plotting is working perfectly.

    I have placed a print statement in the main bar area to output Time, H L O C and my calculation value (that is plotted in the subpayne). The Time value and the calculation values are correctly printed, but the H L O C data contains a single value for all H L O C values on each output line in the output window. It makes no sense what value is being reported back for the H L O C values, each line is different form the previous, but all the H L O C values are the same.

    Any ideas as to why this would occur? Any ideas on how to debug or resolve this?

    I am confident I am referenceing the H L O C data correctly as the graph plotted and the calcuation value derived in this indicator are as I expect based on the H L O C values of the corresponding candle stick bars of the chart.

    #2
    Hello tulanch,

    Sorry, I'm not sure from the description what your script may be doing. If you can post a simplified portion we can take a look here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I did a couple of things and now it's working....

      First I did a database repair for the hell of it, I've seen that fix strange things in the past....

      next, to me the problem looked like it was initialization related, sort of chicken before the egg problem.... having the indicator with CalculateOnBarClose = false and making use of FirstTickOfBar , it made me think to move the printout logic from the first few lines of the indicator's onbarupdate method to the end of this method in an effort to allow the system to properly initialize on a new bar.

      I also got to thinking that using FirstTickOfBar with CalcuateOnBarClose=true may be the problem, so I added appropriate logic ... if CalculateOnBarClose is true, it no longer uses a FirstTickOfBar check but does use [0] indexes for Time, H L O C and the indicator data value. If CalcuateOnBarClose is false, it uses [1] indexes for data values within a OnFirstTickOfBar check.

      I'm not certain when things cleaned up... but it's working as expected now.

      I have a suspision I was using CalcuateOnBarClose = false (process every tic) using [0] indexes within an OnFirstTickOfBar check... this would explain why I had seemingly randon values as it would print out that ticks values, which most likely were always equal to each other.

      thanks for letting me think out loud
      Last edited by tulanch; 08-14-2011, 11:04 PM.

      Comment


        #4
        tulanch, no worries we're glad to hear you got resolve it and move ahead.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        191 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,230 views
        0 likes
        Last Post xiinteractive  
        Working...
        X