Announcement

Collapse
No announcement yet.

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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by HaannyKaab, Yesterday, 04:27 AM
        0 responses
        30 views
        0 likes
        Last Post HaannyKaab  
        Started by aligator, 07-14-2025, 05:09 PM
        0 responses
        62 views
        1 like
        Last Post aligator  
        Started by NTEducationTeam, 07-14-2025, 01:49 PM
        0 responses
        72 views
        0 likes
        Last Post NTEducationTeam  
        Started by NTEducationTeam, 07-14-2025, 01:24 PM
        0 responses
        64 views
        0 likes
        Last Post NTEducationTeam  
        Started by saltminer, 07-07-2025, 01:43 PM
        1 response
        187 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X