• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom RSI Development

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

    Custom RSI Development

    Hello, I'm trying to first make an RSI that alerts when it's oversold or overbought by certain Levels. Instead of usual 70/30 I want 80/20 Overbought/Sold Levels.

    So far I have this:

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(RSI(5, 1).Avg, 80, 1))
    {
    Alert("MyAlert0", Priority.High, "RSI OVERBOUGHT", "", 0, Color.White, Color.Black);
    }

    // Condition set 2
    if (CrossBelow(RSI(5, 1).Avg, 20, 1))
    {
    Alert("MyAlert1", Priority.High, "RSI OVERSOLD", "", 0, Color.White, Color.Black);
    }


    It's Not alerting me of anything. can you tell me what I'm doing wrong? or what I have to input so that it knows to use 80/20 and alert on the cross.

    thanks so much.

    #2
    Hello ginx10k,

    The code for this looks correct.

    Alerts only trigger with real-time data. Are you using the Market Analyzer to test this?

    (I added this code to an indicator and applied this to the ES 06-14 1 Minute. Just a few moments ago the rsi dropped below 20 and I did receive an alert. This alert was at 8:34 MDT)
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I did this in Strategy wizard, added the strategy to USD/JPY 1-min real time. and when it moved above 80, it didn't send alert.

      The area where I placed the 80 and 20 in the code is that correct? does that represent the overbought or oversold??

      why wouldn't this work on my chart, but works on yours.

      Comment


        #4
        Hi ginx10k,

        As you had added this post to the Indicator Development section I assumed to put this code into an indicator.

        Since you have this in a strategy, do you have the strategy enabled?
        (Right-click chart -> Strategies... -> in the parameters is Enabled set to True?)

        On the chart do you see a (D) in front of the strategy name (the D means Disabled).
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi ginx10k,

          You have already done this in the crossover conditions.

          if (CrossAbove(RSI(5, 1).Avg, 80, 1))

          if (CrossBelow(RSI(5, 1).Avg, 20, 1))

          These are hard coded values and cannot be changed by the user.

          If you want to be able to change them and have a default setting, then you need to create User Defined Inputs for these two values and then use the variable in place of the hard coded value.

          The Automated Strategy Development Level 1 course goes over User Defined Inputs.
          https://www.youtube.com/watch?v=Maaq...56536A44DD7105
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            This is awesome thanks. If I have any other questions I'll post here. u guys are awesome!!

            Comment


              #7
              NOT able to PLOT RSI

              Okay, so I tried to Plot the RSI on the chart by calling the
              Code:
              Add(RSI(RsiPeriod,RsiSmooth));
              in the protected override void Initialize() area.

              But I keep getting COMPILE Error. can someone please help me Plot the RSI indicator through my own Indicator. It's attached below

              and this is Compile ERROR: http://screencast.com/t/woux1SfS
              Attached Files

              Comment


                #8
                Ginx,

                You cannot use the Add(Indicator); inside another Indicator. This is a Strategy method only.

                You would need to create a data series that you can then pass through the RSI double values and then apply that to your plots.
                Cal H.NinjaTrader Customer Service

                Comment


                  #9
                  Okay so can someone give me examples of how to do this exactly, as I'm still learning as much as I can, but can't get this to work.

                  Comment


                    #10
                    Ginx,

                    Attached is an example
                    Attached Files
                    Cal H.NinjaTrader Customer Service

                    Comment


                      #11
                      Overbought/Oversold Levels

                      Great example, however, since I literally don't know anything bout those oscillator indicator codes.

                      How do I go about plotting the Upper and Lower Levels. I tried the following code but keep getting errors. HELP Please!!

                      Code:
                       protected override void Initialize() 
                      		{
                      			Add(new Plot(Color.Orange, "RSIPlot"));
                      			Add(new Line(Color.FromKnownColor(KnownColor.DarkOrchid), 20, "Lower"));
                                  Add(new Line(Color.FromKnownColor(KnownColor.MediumBlue), 80, "Upper"));
                      			RsiPlot = new DataSeries(this);
                      			
                      			Overlay				= true;
                      			CalculateOnBarClose = false;	
                      			
                      
                              }
                      
                      		protected override void OnStartUp()
                      		{
                      			RSIPlot.Set(RSI(5,3)[0]);
                      		}
                      		
                              protected override void OnBarUpdate()
                              {
                      			Lower.Set(RSI(5,3)[0]);
                      			Upper.Set(RSI(5,3)[0]);
                      			RSIPlot.Set(RSI(5,3)[0]);
                      		}
                      			
                              #region Properties
                              [Browsable(false)]	
                              [XmlIgnore()]		
                              public DataSeries RSIPlot
                              {
                                  get { return Values[0]; }
                              }
                      
                      		
                      		
                              #endregion
                          }

                      Comment


                        #12
                        Ginx,

                        You won't be able to grab those upper and lower lines as those are plot lines that you can add.

                        Add(new Line(Color.Red, 70, "Upper"));

                        Take a look at the link below on some of the indicator ninjascript items available -
                        http://www.ninjatrader.com/support/h...?indicator.htm
                        Cal H.NinjaTrader Customer Service

                        Comment


                          #13
                          Ok, I'm confused, you said
                          that you can add.

                          Add(new Line(Color.Red, 70, "Upper"));
                          but I already added
                          Code:
                          Add(new Line(Color.FromKnownColor(KnownColor.MediumBlue), 80, "Upper"));

                          and it's NOT plotting the Lines. So is there a way to place those lines or NOT. I need the Oversold and Overbought levels. That Link u gave didn't help at all.

                          Is there any way to get this done.

                          Comment


                            #14
                            I would like to test this on my end,

                            Can you please provide a copy your code in the file format?
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #15
                              The indicator is attached.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pparmley, Today, 04:30 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post pparmley  
                              Started by tonynt, Today, 04:21 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post tonynt
                              by tonynt
                               
                              Started by williamzz, Today, 03:44 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Miguel_88, Yesterday, 06:41 PM
                              2 responses
                              26 views
                              0 likes
                              Last Post Miguel_88  
                              Started by williamzz, Today, 02:12 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Jim  
                              Working...
                              X