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

Debugging with VisualStudio NT8

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

    Debugging with VisualStudio NT8

    Hello,

    I am debugging an Indicator using VisualStudio in NT8 in a backtest. I am trying to understand the object structure of various PriceSeries like High[0], Low[0], etc.

    If I have a simple line of code such as:

    Code:
    m_CurrWaveHigh = Math.Max(m_CurrWaveHigh, High[0]);
    When I try to evaluate High[0] I can not determine where the price of the currentBar is being held.

    For instance, I see High.Bars.CurrentBar = 22. But where is the High Price of CurrentBar 22 held? I thought it would be LastPrice but that is the LastPrice of Bar on Chart not the CurrentBar 22.

    Thanks,

    #2
    Hi tornadoatc,

    When Calculate on bar close is set to True or the script is processing historical data, High[0] will refer to the close of the previous bar.
    When Calculate on bar close is False and the script is processing realtime data, High[0] will refer to the high of the current bar.

    If you are looking for high of the 22nd bar, you can use High[CurrentBar - 22].

    The Close of the 22nd bar can be found with Close[CurrentBar - 22].
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      Thank you for your response. My question is specific to a backtesting scenario. I am stepping through my Bars via debugging through VS (looking through the High Properties using the VS debugging inspection tool) and the next instruction of my code says to compare High[0]. Doesn't this somehow get the High of the Current Bar being processed? If so, what property of the Bars.BarsSeries.??? would I find the HIgh of the CurrentBar being processed (e.g. Bar 22 in my example)?

      Otherwise do I have this all wrong for strategy backtesting? And, you have to look at
      Code:
      High[CurrentBar]
      for the High of current bar being processed and
      Code:
      High[CurrentBar - 1]
      for the High of Previous Bar being processed for Historical data?

      Or, something like
      Code:
       High[BarsArray[0].Count - CurrentBar]
      to get the High of Bar being processed in Backtest ?

      Actually the logic seems to be processing correctly but I just can't see the values in the VS debugger to verify.

      Thanks,

      Comment


        #4
        Hello tornadoatc,

        When backtesting High[0] is the current bar being processed (as when you print High[0] you get the high of the bar being processed).

        If you want the high of the bar 22 bars before the bar being processed, use High[CurrentBar - 22]. CurrentBar will be the bar number of the bar being processed.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timko, Today, 06:45 AM
        0 responses
        1 view
        0 likes
        Last Post timko
        by timko
         
        Started by JonesJoker, 04-22-2024, 12:23 PM
        8 responses
        41 views
        0 likes
        Last Post JonesJoker  
        Started by Waxavi, 04-19-2024, 02:10 AM
        2 responses
        37 views
        0 likes
        Last Post poeds
        by poeds
         
        Started by chbruno, Yesterday, 04:10 PM
        1 response
        44 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Max238, Today, 01:28 AM
        1 response
        24 views
        0 likes
        Last Post CactusMan  
        Working...
        X