Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RSI IDataSeries input custom strategy

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

    RSI IDataSeries input custom strategy

    Dear Support,

    From the manual it seems you can use the following RSI
    RSI(IDataSeries input, int period, int smooth)

    The idea is to test the difference between H,C,O,L,(H+L/2), etc.

    I've tried to integrate that in a custom strategy but without success so far. This is an extract of my code:

    #region Variables
    // Wizard generated variables
    private string vinputrsi = @"Close"; // Default setting for Vinputrsi
    ...
    // Condition set 1
    if (CrossAbove(RSI(Vinputrsi, 14, 3), 20, 1)
    ...
    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public string Vinputrsi
    {
    get { return vinputrsi; }
    set { vinputrsi = value; }
    }

    I have the following errors message CS1502 and NT1503 when I try to compile the custom strategy.

    Any brilliant ideas?
    Kind regards,

    Chris

    #2
    Hi Chris, it would not take a string as input but an IDateSeries - http://www.ninjatrader.com/support/h...dataseries.htm

    If you would like to optimize the input series to drive your strategy, I would simply assign a int to each case and then optimize the int public input in the Strategy Analyzer.

    Comment


      #3
      Sorry Bertrand, this time I don't get it.

      RSI is usually calculated with the Close but it can be customize to another price e.g. open, high, low, etc.

      That is why I choose to create a custom variable as a string and not an integer?

      Am I wrong?

      Comment


        #4
        Yes, you could not pass a string into the RSI overload that would expect an IDataSeries type.

        If you to select / optimize the input series driving the RSI calcs, then set this with a public Integer as needed or change the passed in series for the RSI according to what string value you entered in the public string input.

        Comment


          #5
          You're going beyond my limited coding abilities. do you have an example I could copy? I've been searching the forum since your last reply for an answer I could copycat but everything I've tried does not work.

          RSI(Open, 14, 3), 20, 1) OR RSI(High, 14, 3), 20, 1) works directly but (High+Low)/2 not.

          Thank you, chris

          Comment


            #6
            Chris, correct the first 2 would work - Open and High are data-series so the RSI method could work with it. For the your 3rd one, try passing in the Median : RSI(Median, 14, 3);

            Comment


              #7
              Thank you for the Median but if I wanted to test e.g. (H+O+L+C)/4?
              Also how can I optimize between these price series?

              I am still struggling with the public int or public string you've advised.

              Apologies for being slow

              Comment


                #8
                You would need to create a DataSeries for this and custom calculate it first and then pass this to the RSI method :

                mySeries.Set((Open[0] + Close[0] + High[0] + Low[0]) / 4);

                double myRSI = RSI(mySeries, 14, 3)[0];

                For compiling this snippet, you need to have in variables :

                private DataSeries mySeries;

                and then in the Initialize() :

                mySeries = new DataSeries(this);

                For the optimization, you would define a public int input and then calculate the RSI on different dataseries / price types for each setting so

                if (myInt == 1)
                RSI(Close....)

                if (myInt == 2)
                RSI(Median...)

                ....

                Comment


                  #9
                  Thank you very much sir. I was far from seeing this complexity. This is very useful and I'll give it try. Chris

                  Comment

                  Latest Posts

                  Collapse

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