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:	201
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:	131
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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        164 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        85 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        126 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        207 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        185 views
        0 likes
        Last Post CarlTrading  
        Working...
        X