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

Get bar values from indicator.

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

    Get bar values from indicator.

    I have my chart set to 60 minutes.
    I've added 240 minute indicator.
    If I obtain a value from the indicator as _ind[1], that could be 4 bars ago from the chart or it could be the current bar. This presents a problem while looping through the bars and comparing the OCHL values to the indicator. Does the indicator contain the those bar values or is there an easy way get the correct current chart bar index aligned with the indicator?

    Thanks,

    Eric...

    #2
    Hello Herrwolf1,

    Can you provide more details on what use case you are trying to do here? Are you trying to access indicator values from outside of the current indicator in a Strategy or what specific use case is being used?

    If you are using another indicator or strategy to call the indicator you would need to add the 240 minute series so the indicator can process. Because of adding that series you would have the CurrentBar for that series also so you could get the current value of the series.

    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I'm trying to create a full proof PSAR cross over tool. One that works from a strategy with the current time frame and a different time frame. If the current time frame is set to 60 minutes and the added psar is set to 240 minutes I need to count backwards and compare the High/Low candle values to the a specific index of the 240 PSAR. For example: if the 240 PSAR index is set to [4] then the current 60 minute bar can be [13] through [16].

      // In this scenario _startIndex == 4.
      double _psarHigh = RoundToTickSize(_240psar[_startIndex]);
      double _psarLow = RoundToTickSize(_240psar[_startIndex - 1]);

      // Determine if a cross over exists.
      for (int _i = _startIndex; _i < _lookBack; _i++)
      {

      // On a 60 minute chart [_i] would need to be 13, 14, 15, or 16 to compare with the _240psar.
      // I need a way to convert the count indexes [_i] from the _240psar (an indicator tied to the 240 minute series) to the current time frame.
      double _low = Low[_i];
      double _high = High[_i];


      if (_low > _psarLow && _high < _psarHigh) return true;
      }

      Comment


        #4
        Hello Herrwolf1,

        Thank you for the reply.

        I am not certain what you are asking for help with here. Are you asking how to determine the time range based on your loop? You would likely need to use the Time timestamps and some logic to determine what BarsAgo to use based on what you described. Can you provide more detail on what you needed assistance with?

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        3 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        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
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Working...
        X