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

CCI Moving Average Cross-Over Indicator Development Request

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

    CCI Moving Average Cross-Over Indicator Development Request

    This is how the indicator looks on MT4.


    The MT4 script are as follows:

    #property indicator_separate_window
    #property indicator_buffers 3
    #property indicator_color1 SteelBlue
    #property indicator_color2 Red
    #property indicator_color3 Yellow

    int cci50 = 50; //initiate the CCI lookup period as 50
    int ma144 = 144; //initiate the MA lookup period as 144
    int ma233 = 233; //initiate the MA lookup period as 233
    double g_ibuf_88[];
    double g_ibuf_92[];
    double g_ibuf_96[];
    double gd_124;
    double gd_132;
    double g_icci_140;

    int init() {
    IndicatorBuffers(3);
    SetIndexBuffer(0, g_ibuf_88);
    SetIndexStyle(0, DRAW_HISTOGRAM);
    SetIndexBuffer(1, g_ibuf_92);
    SetIndexStyle(1, DRAW_HISTOGRAM);
    SetIndexBuffer(2, g_ibuf_96);
    SetIndexStyle(2, DRAW_HISTOGRAM);
    return (0);
    }

    int deinit() {
    return (0);
    }

    int start() {
    int l_ind_counted_4 = IndicatorCounted();
    if (l_ind_counted_4 < 0) return (-1);
    int li_8 = Bars - l_ind_counted_4;
    if (li_8 > Bars) li_8 = Bars;
    for (int li_0 = li_8; li_0 >= 0; li_0--) {
    g_icci_140 = iCCI(NULL, 0, cci50, PRICE_TYPICAL, li_0);
    gd_124 = iMA(NULL, 0, ma144, 0, MODE_EMA, PRICE_CLOSE, li_0) - iMA(NULL, 0, ma233, 0, MODE_EMA, PRICE_CLOSE, li_0);
    gd_132 = iMA(NULL, 0, ma144, 0, MODE_EMA, PRICE_CLOSE, li_0 + 1) - iMA(NULL, 0, ma233, 0, MODE_EMA, PRICE_CLOSE, li_0 + 1);
    g_ibuf_88[li_0] = 0.0;
    g_ibuf_92[li_0] = 0.0;
    g_ibuf_96[li_0] = 0.0;
    if (g_icci_140 > 0.0 && gd_124 > gd_132) g_ibuf_88[li_0] = 1.0;
    else {
    if (g_icci_140 < 0.0 && gd_124 < gd_132) g_ibuf_92[li_0] = 1.0;
    else g_ibuf_96[li_0] = 1.0;
    }
    }
    return (0);
    }

    #2
    Thanks for sharing this and welcome to our forums - if you want to start converting this on your own, please have a look at those helpful tutorials -



    If you would like this professionally coded out for you, consider checking into services provided by those NinjaScript consultants -

    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ghoul, Today, 06:02 PM
    0 responses
    4 views
    0 likes
    Last Post ghoul
    by ghoul
     
    Started by Barry Milan, Yesterday, 10:35 PM
    6 responses
    18 views
    0 likes
    Last Post Barry Milan  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    13 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    12 views
    0 likes
    Last Post terofs
    by terofs
     
    Working...
    X