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

Regression Channel + RSI

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

    Regression Channel + RSI

    H. E. L. P. !!!

    I am attempting to make my first strategy using the Market Wizard. I am not a programmer so at this time I chose not to write the script myself.

    I think that I am keeping it real simple but the results have been confusing. To put things in a nut shell, I am seeking to enter a trade when the close price is outside of the Regression Channel and the price crosses over the RSI.

    I have set the initial User Defined Inputs to;

    RegressionTrue and bool = true,
    RegressionFalse and bool = false.
    Not sure if there is any value in these inputs or not.

    SET 1

    In the conditions and actions, I have the following conditions;
    Close > Regression Channel
    Cross Below RSI

    then...

    Enter short 1 contract

    SET 2 is the opposite for Long entries

    The Profit Targets are set at 40 ticks and the Stop Loss is set at 20 ticks

    As you can see, this is a very short strategy. Is it too short?

    After running it on Backtest, the results seemed very good. HOWEVER, after connecting here tonight, Sunday night, it is clear that it is not working as intended. With oil (CL), there were many orders opened and canceled where the price was fluctuating a mere 1-3 ticks. I did adjust the backtest settings in my attempt to optimize. The settings can be viewed here. http://screencast.com/t/F1f0fA19LfZ

    What am I doing wrong here? Why does the backtest, which in this case included some of the time frame that I observed, not accurately depict what is going on in trading? For example, while I observe the strategy open and cancel orders rather quickly returning no profit, the strategy performance shows that it is making money, sometimes quite a lot. This is very misleading.

    Additional Questions

    With the Regression Channel indicator, is it possible, in a strategy, to determine whether it is ascending or descending and weight the trade decision accordingly? For example; if a Regression Channel is heading down and the price Close crosses through the upper RSI line, the buy signal is stronger than if the Close crosses through the lower RSI line (on the way up in a descending trend). One is much more likely to hit targets trading with the trend than against it.

    Using the RSI indicator, I do not see where I can define the line whether it be 30-40 lower line or 60-70 upper line. Theoretically speaking, it's possible the Close could be crossing the wrong RSI line and trade in the wrong direction. I wonder if this is why I am getting all of these crazy entry/exit signals.

    Any help at all is greatly appreciated. Steer my towards some helpful videos if you think they will get me there.

    Best regards,

    Dolfan
    Last edited by Dolfan; 11-23-2015, 09:14 AM. Reason: misplaced text

    #2
    Hello Dolfan,

    Thanks for your post.

    Would you mind posting your strategy? I understand it is pretty straightforward but I'm not clear on how you are using the RSI for example. If you would prefer to not share your strategy with the world, you are welcome to send it in to PlatformSupport[at]Ninjatrader[dot]Com with the subject line of: Form Thread: Regression Channel + RSI and attention:Paul

    Once I see the strategy I will be better able to assist.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Regression/RSI Strategy

      Does this work for you?


      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// Moving inton regression channel and crossing an RSI level of 40 or 60
      /// </summary>
      [Description("Moving inton regression channel and crossing an RSI level of 40 or 60")]
      public class RegressionPlusRSIon5min : Strategy
      {
      #region Variables
      // Wizard generated variables
      private bool regressionTrue = true; // Default setting for RegressionTrue
      private bool regressionFalse = false; // Default setting for RegressionFalse
      // User defined variables (add any user defined variables below)
      #endregion

      /// <summary>
      /// This method is used to configure the strategy and is called once before any strategy method is called.
      /// </summary>
      protected override void Initialize()
      {
      SetProfitTarget("", CalculationMode.Ticks, 40);
      SetStopLoss("", CalculationMode.Ticks, 20, false);

      CalculateOnBarClose = false;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      // Condition set 1
      if (Close[0] > RegressionChannel(60, 2).Lower[0]
      && CrossBelow(Close, RSI(6, 3).Avg, 1))
      {
      EnterShort(1, "Short-1");
      }

      // Condition set 2
      if (Close[0] < RegressionChannel(60, 2).Lower[0]
      && CrossAbove(Close, RSI(6, 3).Avg, 1))
      {
      EnterLong(1, "Long-1");
      }
      }

      #region Properties
      [Description("Crossing into Regression Channel")]
      [GridCategory("Parameters")]
      public bool RegressionTrue
      {
      get { return regressionTrue; }
      set { regressionTrue = value; }
      }

      [Description("Crossing out of Regression Channel")]
      [GridCategory("Parameters")]
      public bool RegressionFalse
      {
      get { return regressionFalse; }
      set { regressionFalse = value; }
      }
      #endregion
      }
      }

      Comment


        #4
        Hello Dolfan,

        Thanks for your reply.

        The CrossBelow and CrossAbove appears to be looking at the close price crossing the RSI average line, is that what you intended? If not can you clarify what you are trying to do with the RSI (or post a marked up screenshot)

        It appears that in both condition sets you are looking at the close price compared to the regression lower line, did you intend for one of them to be the upper line?

        To compare the RSI to a numeric value, put the RSI on the left side of the condition builder (in the "plot" line change to RSI as it defaults to the Avg line), in the middle select CrossAbove or CrossBelow, on the right side select Misc then "numeric value" and enter the numeric value of the line to check. I've added a picture of the selections to make for an RSI CrossAbove the 30 line.

        Here are links to some good reference pages for the wizard:

        Attached Files
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          Hello Dolfan,

          Thanks for your reply.

          The CrossBelow and CrossAbove appears to be looking at the close price crossing the RSI average line, is that what you intended? If not can you clarify what you are trying to do with the RSI (or post a marked up screenshot)

          I had intended for it to use a crossover of the RSI given that it was going in the right direction.

          It appears that in both condition sets you are looking at the close price compared to the regression lower line, did you intend for one of them to be the upper line?

          I had intended for it to read outside of the Regression Channel either upper or lower. If above the Regression Channel, look for a crossover of the upper RSI (headed down). If below the Regression Channel, look for a crossover of the lower RSI (headed up). How is it that I isolated it to the lower Regression Channel line?

          To compare the RSI to a numeric value, put the RSI on the left side of the condition builder (in the "plot" line change to RSI as it defaults to the Avg line), in the middle select CrossAbove or CrossBelow, on the right side select Misc then "numeric value" and enter the numeric value of the line to check. I've added a picture of the selections to make for an RSI CrossAbove the 30 line.

          This looks to be the best solution as I understand it now. However, will this address the location as referenced to the Regression Channel?

          Here are links to some good reference pages for the wizard:

          http://ninjatrader.com/support/helpG...gy_actions.htm
          Can you look at my other questions at the bottom regarding the Regression Channel and RSI? Specifically, can the Regression Channel tilt (trend) be referenced in a strategy?

          Thank you so much for your assistance.

          Best regards,

          Dolfan

          Comment


            #6
            I found the Regression Channel upper and lower settings. Thanks!

            Comment


              #7
              Hello Dolfan,

              Thanks for your posts.

              For the RSI you can check if it is crossing the Avg line, or if it is crossing a set line, just depends on when and where you want that condition. For RSI over Avg you would set up the RSI on the left as described before then crossabove or crossbelow in the middle and then RSI is set up on the right but leave it at the default Avg for plot (Make sure the RSI values on left and right side are the same except the left is plot RSI and the other is plot Avg).

              Yes, you can determine if the regression channel is falling or rising however the determination of that can be visually misleading because you are looking at projected straight lines while comparing the regression line's last two plotted points. I have attached the wizard screen needed to create rising condition.
              Attached Files
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                OK, I can see how that works. Is it possible to adjust the angle for a stronger trend?

                Thanks!

                Best regards,

                Dolfan

                Comment


                  #9
                  Hello Dolfan,

                  Thanks for your post.

                  Not really an angle but you could add more Regression channel conditions, so for rising you have [0] > [1] you could add [1] > [2] and [2] > [3], to say that the channel has been rising the last 3 bars.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Yea, that's what I was thinking too. It would be nice if I could dictate the ticks or percent in change. <sigh>

                    Best regards,

                    Dolfan

                    Comment


                      #11
                      I tried this with the settings at 0, 2, 4, 6 &10 but the results were not favorable. You showed an example of the setup screen with the Regression Channel Period set at 60. The default is set at 120. Have you found that 60 is a better time frame to indicate movement? Thanks once again.

                      Best regards,

                      Dolfan

                      Comment


                        #12
                        Hello Dolfan,

                        Thanks for your post.

                        The use of 60 for the regression channel was based on what you showed in your post (#3 in this thread), "if (Close[0] > RegressionChannel(60, 2).Lower[0]" and wanted to keep the examples relevant for you.

                        On mine, a 35 period is the default.

                        I can't advise what would be optimal settings but testing is a good way to establish those for the market(s) you intend to use them in.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Hmm, 35 eh? I'll take a look at that. How do you use your Regression Channels? If you don't mind me asking.

                          Best regards,

                          Dolfan

                          Comment


                            #14
                            Hello Dolfan,

                            Thanks for your post.

                            We cannot provide trading advise.
                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              But I am guessing since you answered this post on Regression Channels, you do use them? I haven't seen much discussion about them. Always with the MACD and Fibonacci, never with the Regression. Anyhow....

                              I just noticed that the Market Analyzer now displays % change for Forex....Finally!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by kevinenergy, Yesterday, 12:01 PM
                              8 responses
                              24 views
                              0 likes
                              Last Post kevinenergy  
                              Started by tradingnasdaqprueba, 05-07-2024, 03:42 AM
                              14 responses
                              59 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by nightstalker, Today, 01:32 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by DawnTreader, 05-08-2024, 05:58 PM
                              15 responses
                              49 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by ZeroKuhl, Yesterday, 04:31 PM
                              7 responses
                              40 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X