Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Bollinger Values with BarsAgo indexing

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

    Incorrect Bollinger Values with BarsAgo indexing

    Dear NT8 Support team,


    I'm calculating the Bollinger values for current bar and past 2 period bars, but I get incorrect values. When I try to go back to historical bar using "int barsAgo" and calculate the Bollinger values, I'm not getting the correct number? Could you please check?

    Bollinger(ISeries<double> input, double numStdDev, int period).Lower[int barsAgo]
    Bollinger(ISeries<double> input, double numStdDev, int period).Upper[int barsAgo]

    //bollinger for 15 min time frame - current or recently closed bar
    bollingerALT = (Bollinger(BarsArray[1],2,8).Upper[0] - Bollinger(BarsArray[1],2,8).Lower[0]);
    bollingerUpLT = Bollinger(BarsArray[1],2,8).Upper[0];
    bollingerBLT = Math.Round((bollingerALT / bollingerUpLT) * 100, 2);


    //bollinger for 15 min time frame - barsAgo[2]
    bollingerALT = (Bollinger(1, 14).Upper[2] - Bollinger(1, 14).Lower[2]);
    bollingerUpLT = Bollinger(1, 14).Upper[2];
    bollingerBLT = Math.Round((bollingerAST / bollingerUpST) * 100, 2);
    Print(string.Format("{0} | Time[2]: {1}, Bollinger Value [2]:{2}", Time[0], Time[2], bollingerBLT));

    #### Output ####

    3/14/2022 9:00:00 PM - Current bollinger -15 min time frame - 0.27
    3/14/2022 9:00:00 PM | Time[2]: 3/14/2022 8:30:00 PM, Bollinger Value [2]:0.21

    3/14/2022 9:15:00 PM Current bollinger -15 min time frame - 0.27
    3/14/2022 9:15:00 PM | Time[2]: 3/14/2022 8:45:00 PM, Bollinger Value [2]:0.21

    3/14/2022 9:30:00 PM Current bollinger -15 min time frame- 0.33
    3/14/2022 9:30:00 PM | Time[2]: 3/14/2022 9:00:00 PM, Bollinger Value [2]:0.2

    3/14/2022 9:45:00 PM - Current bollinger -15 min time frame- 0.49
    3/14/2022 9:45:00 PM | Time[2]: 3/14/2022 9:15:00 PM, Bollinger Value [2]:0.3

    3/14/2022 10:00:00 PM Current bollinger -15 min time frame- bollingerBLT - 0.54
    3/14/2022 10:00:00 PM | Time[2]: 3/14/2022 9:30:00 PM, Bollinger Value [2]:0.37


    #2
    Hello radhmu978,

    I am not certain I understand the question in contrast to the prints. Are you saying that one of the actual Bollinger values is not correct in some way?

    Do you have a more simple example that does not involve the math you are printing out?

    Comment


      #3
      this is an issue with BarsAgo index. If i go back based on historical Bars, I'm not getting the right values


      Bollinger(ISeries<double> input, double numStdDev, int period).Lower[int barsAgo]
      Bollinger(ISeries<double> input, double numStdDev, int period).Upper[int barsAgo]

      Comment


        #4
        Hello radhmu978,

        I understand that part of the concern however I don't understand the question with the print you provided. Are you seeing the BarsAgo on one of the Bollinger's is not working as expected? The math would need to be removed from the sample to see the base indicator values.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X