• 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

Creating a Dynamic Threshold for RSI

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

    Creating a Dynamic Threshold for RSI

    Using RSI as a tool for identifying over-bought or over-sold markets is useful when markets are range-bound. But when a market wants to make a sustained one-directional move, RSI will generate a lot of false signals on the opposite side of that move.

    On the other hand, in such a strong-trending market, RSI typically can't reach its threshold on the side of that sustained move. For example, if your usual threshold for a sell-side entry is, say, 90, when market is moving strongly downward, RSI rarely will reach 85-88.

    I would like to build in to my strategy recognition of that concept. So, my idea is this:

    By defining a Lookback int variable, which would specify a look-back period, I would like my strategy to test whether market has reached that usual SignalThreshold (a double variable) during the Lookback period. If it has not, I then would like my strategy to adjust SignalThreshold by some amount (for example, 2 increments).

    My question is this:

    How do I code such a contingency into an existing strategy? That is, by using the sell side as an example, if market has not attained SignalThreshold during the Lookback period, adjust SignalThreshold to SignalThreshold - 2.

    I have tried amending my strategy to include the following, but it won't compile:

    {

    if (MAX(RSI(xx,xx),Lookback)[0] < SignalThreshold)

    SignalThreshold == SignalThreshold - 2.0;

    }

    else if ....

    Am I on the wrong track to accomplish what I want?

    #2
    Hi Longhornmark,

    Thanks for your post.

    I think the MRO() method will be useful for finding this, the MAX method is also a solution. What part of that will not compile? It looks like you just have "xx" for the parameters of RSI you must supply two integers, a period value and a smoothing value.

    Please let me know if I can assist further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      You want '=' instead of '=='

      Also, this is equivalent and a shorter way of writing it: SignalThreshold -= 2.0;

      *Not sure if those parentheses are in your real code, but they are surrounding the 'if' statement, so you wouldn't be able to link an 'else if' to it.

      This would fix it:

      if (MAX(RSI(xx,xx),Lookback)[0] < SignalThreshold)
      {
      SignalThreshold = SignalThreshold - 2.0;
      }
      else if..
      Last edited by anon84; 05-23-2019, 10:24 AM. Reason: parentheses

      Comment


        #4
        Indeed, it did compile with your simple edit! Thanks for your help!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by akitenge, 06-14-2019, 02:54 PM
        4 responses
        27 views
        0 likes
        Last Post chartish  
        Started by siriusm, Today, 09:15 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by Duval, Today, 09:27 AM
        2 responses
        5 views
        0 likes
        Last Post Duval
        by Duval
         
        Started by chazyang, Today, 08:11 AM
        2 responses
        6 views
        0 likes
        Last Post chazyang  
        Started by Erwin Beckers, 11-04-2018, 02:39 AM
        6 responses
        79 views
        2 likes
        Last Post koganam
        by koganam
         
        Working...
        X