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

STARC (or Stoller Average Range Channels)

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

    STARC (or Stoller Average Range Channels)

    Hello,

    Can you please port this code into NT Indicator. This is for creating starc bands.

    Thanks.


    #property copyright "Copyright © 2005, MetaQuotes Software Corp."
    #property link "http://www.metaquotes.net/"
    //----
    #property indicator_chart_window
    #property indicator_buffers 3
    #property indicator_color1 Purple
    #property indicator_color2 Blue
    #property indicator_color3 Red
    //---- indicator parameters
    extern int BandsPeriod = 6;
    extern int ATR = 15;
    extern double Multiplier = 2.0;
    extern int BandsShift = 0;
    //---- buffers
    double MovingBuffer[];
    double UpperBuffer[];
    double LowerBuffer[];
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    //---- indicators
    SetIndexStyle(0, DRAW_LINE);
    SetIndexBuffer(0, MovingBuffer);
    SetIndexStyle(1, DRAW_LINE);
    SetIndexBuffer(1, UpperBuffer);
    SetIndexStyle(2, DRAW_LINE);
    SetIndexBuffer(2, LowerBuffer);
    //----
    SetIndexDrawBegin(0, BandsPeriod + BandsShift);
    SetIndexDrawBegin(1, BandsPeriod + BandsShift);
    SetIndexDrawBegin(2, BandsPeriod + BandsShift);
    //----
    return(0);
    }
    //+------------------------------------------------------------------+
    //| Bollinger Bands |
    //+------------------------------------------------------------------+
    int start()
    {
    int i, k, counted_bars = IndicatorCounted();
    double deviation;
    double sum, oldval, newres;
    //----
    if(Bars <= BandsPeriod)
    return(0);
    //---- initial zero
    if(counted_bars < 1)
    for(i = 1; i <= BandsPeriod; i++)
    {
    MovingBuffer[Bars-i] = EMPTY_VALUE;
    UpperBuffer[Bars-i] = EMPTY_VALUE;
    LowerBuffer[Bars-i] = EMPTY_VALUE;
    }
    //----
    int limit = Bars - counted_bars;
    if(counted_bars > 0)
    limit++;
    for(i = 0; i < limit; i++)
    MovingBuffer[i] = iMA(NULL, 0, BandsPeriod, BandsShift,
    MODE_SMA, PRICE_CLOSE, i);
    //----
    i = Bars - BandsPeriod + 1;
    if(counted_bars > BandsPeriod - 1)
    i = Bars - counted_bars - 1;
    while(i >= 0)
    {
    sum = 0.0;
    k = i + BandsPeriod - 1;
    oldval = MovingBuffer[i];
    while(k >= i)
    {
    newres = Close[k] - oldval;
    sum += newres*newres;
    k--;
    }
    deviation = Multiplier*iATR(NULL, 0, ATR, i); // MathSqrt(sum / BandsPeriod);
    UpperBuffer[i] = oldval + deviation;
    LowerBuffer[i] = oldval - deviation;
    i--;
    }
    //----
    return(0);
    }

    #2
    Hi wsjalerts13, thanks for posting the code - hopefully someone takes it up as a conversion project. If you need this done via custom programming for you, you can always contact those NinjaScript consultants - http://www.ninjatrader.com/webnew/pa...injaScript.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I am not a programmer. does anyone have a .zip file for Starc Bands???? Thanks!!

      Comment


        #4
        STARC Bands are near-identical to Keltner Channels. Here is a comparison:


        Midband

        Keltner Channel: midband is a simple moving average of the typical prices (typical price = 1/3 * high + 1/3 * low + 1/3 * close)
        STARC Bands: midband is a simple moving average of the bar closes


        Channel lines

        Keltner Channel: Upper channel is calculated by adding a multiple of the average range to the midband. Lower channel is calculated by subtracting a multiple of the average range from the midband

        STARC Bands: Upper channel is calculated by adding a multiple of the average true range to the midband. Lower channel is calculated by subtracting a multiple of the average true range from the midband.

        The difference in the formula for calculating the midbands is barely noticeable. The midband of the Keltner Channel is slightly smoother compared to the midband of the STARC channel.

        For the channel lines there is only a difference, if there are gaps on the chart. Otherwise average range and average true range are identical. If you look at intraday data for liquid instruments, there is virtualy no difference.

        STARC Bands

        I have created a universal version of the Keltner Channel that allows to select 27 different moving averages for the midband. The channel lines can be calculated by using either an average of the simple range (in line with the original Keltner Channel) or an average true range (in line with the STARC bands). If you select the true range option, you will basically see STARC bands with a slightly smoother midband. For all practical purposes you can consider them as STARC Bands.

        The indicator can be found here:

        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies


        If you are not a member of Big Mike's, send me a private message to get a copy of the indicator.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,611 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        22 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X