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

Better Bollinger Bands - HELP!

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

    Better Bollinger Bands - HELP!

    Has Anyone been able to recreate Dennis McNicholl's Better Bollinger Bands (BBB) in Ninja Trader?

    I have the code in a couple languages, but I don't know ninja script well enough to translate it. Any insight is greatly appreciated!

    Here it is in TradeStation:

    inputs: period(20), factor(2.0);
    vars: alpha(0), mt(0), ut(0), dt(0), mt2(0), ut2(0), dt2(0), but(0), blt(0);

    { smoothing constant }
    alpha = 2/(period + 1);

    mt = alpha*close + (1 - alpha)*mt;
    ut = alpha*mt + (1 - alpha)*ut;
    dt = ((2 - alpha)*mt - ut)/(1 - alpha);
    mt2 = alpha*absvalue(close - dt) + (1 - alpha)*mt2;
    ut2 = alpha*mt2 + (1 - alpha)*ut2;
    dt2 = ((2 - alpha)*mt2 - ut2)/(1 - alpha);
    but = dt + factor*dt2;
    blt = dt - factor*dt2;

    plot1(dt,"center");
    plot2(but,"upper");
    plot3(blt,"lower");


    And here it is in Metastock code:

    Better Bollinger Bands I
    pds:=Input("Periods",2,200,20);
    sd:=Input("Standard Deviations",.01,10,2);
    alpha:=2/(pds+1);
    mt:=alpha*C+(1-alpha)*(If(Cum(1)<pds,C,PREV));
    ut:=alpha*mt+(1-alpha)*(If(Cum(1)<pds,C,PREV));
    dt:=((2-alpha)*mt-ut)/(1-alpha);
    mt2:=alpha*Abs(C-dt)+(1-alpha)*PREV;
    ut2:=alpha*mt2+(1-alpha)*PREV;
    dt2:=((2-alpha)*mt2-ut2)/(1-alpha);
    but:=dt+sd*dt2;
    blt:=dt-sd*dt2;
    dt;
    but;
    blt


    Thanks!

    #2
    Here is a simple version based on the NinjaTrader Bollinger Bands.
    Attached Files

    Comment


      #3
      Hello B-Rex,

      Thanks for your post and thanks to Harry for his contribution in answer to your post.

      Please let me know if you need further assistance.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        This worked wonderfully, thank you

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ScottW, Today, 06:09 PM
        0 responses
        2 views
        0 likes
        Last Post ScottW
        by ScottW
         
        Started by Board game geek, 10-29-2023, 12:00 PM
        14 responses
        244 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        4 responses
        56 views
        0 likes
        Last Post sonia0101  
        Started by cmtjoancolmenero, Today, 03:58 PM
        0 responses
        9 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by Segwin, 05-07-2018, 02:15 PM
        11 responses
        1,778 views
        0 likes
        Last Post aligator  
        Working...
        X