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

SwingHigh/Low CCI Indicator

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

    SwingHigh/Low CCI Indicator

    Can you please tell me how I can do an indicator that plot SwingHigh/SwingLow CCI?

    I tried apply an indicator on other as Tutorial Level 2 and only show me SwingHigh. How I plot diferently SwingHigh/SwingLow?

    Thank you

    #2
    RitaPacheo, you would need to access either the SwingHigh or SwingLow of the Swing indicator method, like in the snippet below -

    Plot0.Set(Swing(CCI(14), 5).SwingHigh[0]);
    Plot1.Set(Swing(CCI(
    14), 5).SwingLow[0]);
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand

      It works very well. I need to plot only a dot on each high/low CCI (over CCI line) with the swing doesn't work like this it seems that only plot a line during the SwingHigh/SwingLow fase (If I change line to dot it give me a line of dots). I tried to use ZigZag the same way you told me for Swing:

      Plot0.Set(ZigZag(CCI(cCIPeriod),DeviationType.Poin ts,0,false).ZigZagHigh[0]);
      Plot1.Set(ZigZag(CCI(cCIPeriod),DeviationType.Poin ts,0,false).ZigZagLow[0]);

      That gave me the same result as Swing.

      Can you please tell me what I need to do?

      Best

      Comment


        #4
        Can you tell me please what is the funtion that give me the number of bars ago since swing happens? Or bars since CCI crosses the zeroline.

        If I want to know the Max CCI since Swing High can I use MAX(CCI(14), BarsSinceSwingHigh)? So I need to know BarsSinceSwingHigh. Is it MAX funtion the best option in this case?

        Thanks

        Comment


          #5
          NT gave me an error in these codes: the operator && can not be used with operator type "double" and "bool". How can I change &&?

          if ((Swing(CCI(period), strength).SwingHigh [0]) && CCI(period)[0] < MAX(CCI(period), barsAgoup)[0] && CCI(period) [0]>0)
          {

          BackColor = Color.Brown;

          }
          else if ((Swing(CCI(period), strength).SwingLow [0]) && CCI(period)[0] > MIN(CCI(period), barsAgodown)[0] && CCI(period) [0]<0)
          {
          BackColor = Color.Blue;

          }

          Comment


            #6
            Hello,

            The condition has to evaluate to true or false using <,>,==,!=, or a boolean. For example the first part of your first condition is just a double value. You have to use a comparison operator.
            DenNinjaTrader Customer Service

            Comment


              #7
              Thanks Ben is ok now.

              Now I have an error on code to know how many bars ago was Max CCI, I don't understand why

              int barsAgo_maxcci= MRO(delegate{return (MAX(CCI(period), barsAgo_100Xup))[0];},1,barsAgo_100Xup);// Max CCI bars ago

              I have this on protected override void OnBarUpdate() part after 2 more barsago ints that are working fine. Would you please tell me why this one has an error?

              Thanks

              CODE:

              protected override void OnBarUpdate()
              {
              int barsAgo_100Xup = MRO(delegate{return (CCI(period)[0] > 100 && (CCI(period)[Math.Min(CurrentBar, 1)]==0 ? CCI(period)[Math.Min(CurrentBar, 2)]<100 : CCI(period)[Math.Min(CurrentBar, 1)]<100));},1,CurrentBar) +1;// 100 line cross up
              int barsAgo_n100Xdown= MRO(delegate{return (CCI(period)[0] < -100 && (CCI(period)[Math.Min(CurrentBar, 1)]==-100 ? CCI(period)[Math.Min(CurrentBar, 2)]>-100 : CCI(period)[Math.Min(CurrentBar, 1)]>-100));},1,CurrentBar) +1;// -100 line cross up
              int barsAgo_maxcci= MRO(delegate{return (MAX(CCI(period), barsAgo_100Xup))[0];},1,barsAgo_100Xup);// Max CCI bars ago

              Comment


                #8
                Hello Rita,

                This is most likely the same issue you were running into earlier. Your MRO statement is looking for a condition and none is defined.

                int barsAgo_maxcci= MRO(delegate{return (MAX(CCI(period), barsAgo_100Xup))[0];},1,barsAgo_100Xup);// Max CCI bars ago

                MAX returns a number for the highest value CCI for barsAgo_100Xup periods.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,228 views
                0 likes
                Last Post xiinteractive  
                Started by andrewtrades, Today, 04:57 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                7 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                440 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                12 views
                0 likes
                Last Post FAQtrader  
                Working...
                X