Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A particular part of my strategy

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

    A particular part of my strategy

    Hi,

    I am trying to figure out how to program a piece of my strategy that involves CCI.

    How do I make so that I can get the trade to activate ONLY when the CCI HOOKS? I have gotten it to activate the trade on the 2nd and 3rd bar after it hooks and goes below the 50 line, but I want it to only take the trade when three particular CCI's hook AT THE SAME TIME and on THAT bar, not 2 or 3 bars later...but to get into the trade only when 3 CCI's (20, 50 and 70) hook the 120 line - TOGETHER and on that bar ONLY.

    Thanks for your help....:-)

    #2
    There are many ways to implement what you're trying to do.

    I made an indicator (attached) which will give you a visual of the times when the conditions you're interested in are true, and from there you can tweak your trade selection criteria to find something that works for you.
    Attached Files

    Comment


      #3
      KBJ,

      Thank you SO VERY MUCH for posting this here and taking the time to make an indicator. But what I want is to know how make program in there myself as well.

      For example when I put in V1 as 50 and then go to ADD it, I choose CCI 50 > V1 and it will show me that it will take a trade when the CCI 50 CCI comes back through the 50, but I only want it to take a trade when the 50CCI hooks the 50 line on THAT BAR, not if it happens 2 or 3 bars later...

      You understand what I mean, and THANK YOU AGAIN for making that indicator. But I need to know how to enter this command into the strategy builder fields.

      Heck, I don't even know what to do with your file!!!!

      Let me sincerely thank you again for taking the time to make this indicator. Maybe you can let me know where to put the darn thing, too! I want to also be to OPTIMIZE all three CCI's when they all hook at the same time as well...if you know what I mean??

      Comment


        #4
        How about starting with a definition for what a CCI hook is?
        RayNinjaTrader Customer Service

        Comment


          #5
          Hi Ninja Trader Ray,

          What I mean by a CCI hook is when the Channel Commodity Index, say... with a setting of 30....is travelling up through the 0 line and then reaches the 50 line and then hooks back through the 50 line going South now. I want my trade to activate when it hooks and I also want to other CCI settings, of my choosing, to hook at the SAME TIME.. And I only want the trade activated when they all hook at the same time, not when one CCI hooks the say..50 line...and is now travelling down a few bars and then the trade activates when the other CCI's finally come back through the 50 line. no, that's not what I want.. I want the trade to activate only when they all "bend back" simultaneously.

          I hope I've made myself clear and not confused the issue.

          Thank you in advance... :-)

          Comment


            #6
            Ray: I know what your mean. I was assuming that I understood what a "hook" was based on reading up on woodies indicators where the term is used a lot (but never really defined.) I'd assumed that bigdaddo wanted to initiate a trade when the value of the CCI changed direction ("hooked") when it had a minimum value of 120.

            bigdaddo: Since I already had a similar indicator, it only took 10 minutes or so to modify and test this, so no big deal. To import the indicator, please refer to these help instructions: http://www.ninjatrader-support.com/H...e.html?Import1

            Once you've installed the indicator, you can try it out, and it will give you a visual representation of when the three CCI's you mentioned all go above 120.

            This visual representation may show you that one or more of the comparisons needs to be changed to other than 120 (perhaps this was what the "50" value was all about in your most recent posting.)

            If you tweak this until you get it to visually indicate when you want to enter/exit trades, and do this as an indicator (instead of a strategy), I think that ultimately you'll save a lot of time. It's the old "know before you go" or "look before you leap" principle.

            Indicators are much simpler to create and use, and if they show what you're looking for, then it's time to write a stategy, which can be much more complicated.

            I hope I'm not raining on your parade, but in my opinion, this will get you to the point of having a winning strategy much faster.

            Comment


              #7
              KBJ,

              Thank you very much. I will take your advise and I will let you know what comes of it.

              Have a great night and thanks again...

              One more thing KBJ know that I think of it. Would you happen to know how to get an EMA to SLOPE! :-) lol

              Comment


                #8
                I'm afraid I don't understand.

                Are you asking how to determine the slope of an EMA plot?

                If so, you could try something like this:

                Code:
                // Get the time difference between current bar and prior bar
                TimeSpan ts = new DateTime(Time[0].Ticks,DateTimeKind.Utc) - new DateTime(Time[1].Ticks,DateTimeKind.Utc);
                
                // Calculate the different between two moving averages and convert to a point value
                double y_delta = (EMA(20)[0] - EMA(20)[1]) * Instrument.MasterInstrument.PointValue;
                
                // Calculate the slope (price/time) and convert to an angle in radians (arc-tangent function),
                // then multiplying the angle in radians by 180/PI to yield the angle in degrees.
                double cur_angle = Math.Abs( (180/Math.PI) * Math.Atan( y_delta/ts.TotalSeconds ));

                Comment


                  #9
                  Hi KBJ,

                  Again I must start by saying a big "Thank You" for taking the time to reply and the info you've included for me.

                  What I am asking is how I can get a trade to activate only under the condition that the EMA 12 is sloping say....down towards 5 O'Clock...a good slope....

                  Thanks again..

                  Comment


                    #10
                    Try this...

                    Code:
                    // Get the time difference between current bar and prior bar
                    TimeSpan ts = new DateTime(Time[0].Ticks,DateTimeKind.Utc) - new DateTime(Time[1].Ticks,DateTimeKind.Utc);
                    
                    // Calculate the different between two moving averages and convert to a point value
                    double y_delta = (EMA(12)[0] - EMA(12)[1]) * Instrument.MasterInstrument.PointValue;
                    
                    double ratio_adjustment = 1;  // Change this to adjust for a compressed time axis.
                    
                    // Calculate the slope (price/time) and convert to an angle in radians (arc-tangent function),
                    // then multiplying the angle in radians by 180/PI to yield the angle in degrees.
                    double cur_angle = Math.Abs( (180/Math.PI) * Math.Atan( y_delta/ts.TotalSeconds * ratio_adjustment ));
                    
                    if (cur_angle < -60)          // More than negative 60 degrees from horizontal?
                    {                             // Yes.
                       Print( "Angle is downwards more than 5 O'Clock" );
                    }
                    You should note that the angle between money and time is a relative thing. It depends on how compressed the time axis is, so 60 degrees on my chart may not be 60 degrees on yours. Therefore, you may need to change the "ratio_adjustment" to get the angle to work "right" for you... This is something that must be determined empirically.

                    Comment


                      #11
                      KBJ,

                      This is good. Thank you extremely much! Let me ask you another question if I may, something where relativety will not apply. Would it be easy to set it so the trade is only activated when PRICE IS X TICKS FROM THE EMA. How's that? Would that be an easy one to program?

                      Kudos for all you do....

                      Comment


                        #12
                        Perhaps this would work for you...

                        Code:
                        double ema_price_diff = Close[0] - EMA(12)[0];  // How far price is above the EMA.
                        double trigger_threshold = 5;
                        
                        if (ema_price_diff > trigger_threshold)
                        {
                           EnterLong();
                        }
                        
                        if (ema_price_diff < -trigger_threshold)
                        {
                           EnterShort();
                        }
                        You'll probably want to play with the "trigger_threshold" depending on what you're trading.

                        Comment


                          #13
                          KBJ,

                          Gracias for your help yet again. Do you mind emailing me?
                          Last edited by bigdaddo; 11-22-2007, 11:46 AM.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          571 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          330 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          549 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          549 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X