Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Random Bollinger calculation variances

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

    Random Bollinger calculation variances

    NT8 Team,

    I am experiencing random changes to the representation of Bollinger bands from a custom strategy. Sometimes they are colored correctly, other times they appear to be way off.

    Here's the code I use to designate 3 Bollinger bands:

    Code:
    else if (State == State.DataLoaded)
    {
    
    Bollinger1 = Bollinger(Close, 2, 14);
    Bollinger2 = Bollinger(Close, 1, 14);
    Bollinger3 = Bollinger(Close, 3, 14);
    Bollinger1.Plots[0].Brush = Brushes.DarkOrange;
    Bollinger1.Plots[1].Brush = Brushes.Goldenrod;
    Bollinger1.Plots[2].Brush = Brushes.DarkOrange;
    
    Bollinger2.Plots[0].Brush = Brushes.LawnGreen;
    Bollinger2.Plots[1].Brush = Brushes.Goldenrod;
    Bollinger2.Plots[2].Brush = Brushes.LawnGreen;
    
    Bollinger3.Plots[0].Brush = Brushes.Goldenrod;
    Bollinger3.Plots[1].Brush = Brushes.Goldenrod;
    Bollinger3.Plots[2].Brush = Brushes.Goldenrod;
    
    AddChartIndicator(Bollinger1);
    AddChartIndicator(Bollinger2);
    AddChartIndicator(Bollinger3);
    VOLMA1 = VOLMA(Close, 14);
    VOLMA1.Plots[0].Brush = Brushes.Goldenrod;
    AddChartIndicator(VOLMA1);
    ATR1 = ATR(Close, 14);
    ATR1.Plots[0].Brush = Brushes.DarkCyan;
    AddChartIndicator(ATR1);
    
    //SetTrailStop(@"TrailstopTickVal", CalculationMode.Currency, 0, true);
    }
    But this morning they aren't colored correctly and I appear to have an extra set on a longer timeframe or something.

    Click image for larger version

Name:	Screenshot 2022-03-14 073810.jpg
Views:	194
Size:	233.8 KB
ID:	1193729

    And if I change nothing in the code, but remove the strategy and reapply the strategy, then I get a totally different situation:


    Click image for larger version

Name:	Screenshot 2022-03-14 074211.jpg
Views:	124
Size:	239.5 KB
ID:	1193730

    Is there a way to get reliable Bollinger calculations consistently represented on the chart?
    ​​​​​​​

    #2
    NT8 Team,

    I was able to resolve this issue by changing the color name of the VOLMA indicator to "Chartreuse". Apparently, using too many indicators in the same color was causing the compiler to be confused.

    Thanks.

    Comment


      #3
      Hello AnotherWorkingHomeless,

      Thank you for your post.

      So that I may best try to reproduce, are you running this OnBarClose, OnPriceChange or OnEachTick? Who is your data provider?

      Thanks in advance; I look forward to assisting you further.

      Comment


        #4
        Thank you NinjaTrader_Kate,

        I am using OnPriceChange. My data provider is IQFeed.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        88 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        48 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        31 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        34 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        68 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X