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

2 CCI-MA for crossover signals

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

    2 CCI-MA for crossover signals

    Hey guys, need some help.

    I am complete coding newbie, tried to code using "indicator on indicator" section of the "Help" file in NT but couldn't get it to work.

    What I want is that, on the same indicator, a SMA(y periods) of CCI(x periods) and a SMA(z periods) of CCI(x) periods.

    E.g a 10SMA of CCI(14) and 5SMA of CCI(14) so that I can use the crossover of these as signals. Those are just example numbers, I'd like them to be changable so I can have different settings for different time periods.

    Anyone able to help?

    #2
    This What you Wanted?

    #region Variables
    privateint cCIperiod1 = 13;
    privateint cCIperiod2 = 13;
    privateint avgLength1 = 5;
    privateint avgLength2 = 10;
    #endregion
    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "Plot0"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Plot1"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "Plot3"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "Plot4"));

    }

    protectedoverridevoid OnBarUpdate()
    {
    Plot0.Set((SMA(CCI(CCIperiod1), AvgLength1)[
    0]));
    Plot1.Set((SMA(CCI(CCIperiod2), AvgLength2)[
    0]));
    Plot3.Set(
    100);
    Plot4.Set(-
    100);
    }
    Last edited by ThatManFromTexas; 12-12-2008, 07:47 PM.

    Comment


      #3
      Hey thanks for the reply, but I'm not sure where to insert that code.

      I tried to paste the code into where I believed were the relevent areas but I just received a load of errors.

      I'd really appreciate a layman's guide/step by step of how to do this if you have the time.

      Either way, thanks for the input!

      Comment


        #4
        Hi ttttt1,

        I would suggest you first work yourself through the different tutorials before attempting your custom code project, this way you get a good overview and get also used to the synthax - http://www.ninjatrader-support.com/H...verview18.html

        Then you can use your already started code snippet and debug by doubleclicking on each error that you get...

        For an example of how a CCI Moving Average can be coded, see this link from our sharing section please - http://www.ninjatrader-support2.com/...rch=CCI&desc=1

        Please see also this thread here on how to resolve NinjaScript programming errors you may encounter - http://www.ninjatrader-support2.com/...ead.php?t=4678

        Have a great weekend!
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        17 views
        0 likes
        Last Post f.saeidi  
        Started by Mikey_, 03-23-2024, 05:59 PM
        3 responses
        49 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by philmg, Today, 12:55 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by TradeForge, 04-19-2024, 02:09 AM
        2 responses
        32 views
        0 likes
        Last Post TradeForge  
        Working...
        X