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 helpwanted, Today, 03:06 AM
        1 response
        10 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        9 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        387 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X