Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RSI Strategy

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

    RSI Strategy

    Please can someone help me with this strategy, its a simple RSI, MA cross system but myprogramming capabilities are very basic and i am strugling to get this sorted.

    I have the system entering long?short trades when the RSI crosses above or below the MA.

    The problem is I only want the strategy to trade short when the cross happens above the 80 line and trade long when the crossover happens below the 20 line.

    Please can someone help me with this code, everything i try comes up with compile errors...
    Attached Files

    #2
    mccallum,

    Please find an example below.

    Code:
                // Condition set 1
                if ( CrossBelow(RSI_MA_350(3, 3).RSI_Plot, RSI_MA_350(3,3). RSI_MA_350_Plot, 1) && RSI(3,3)[0]>80 )							
                {
                    EnterShort(DefaultQuantity, "");
                }
    
                // Condition set 2
                if ( CrossAbove(RSI_MA_350(3, 3).RSI_MA_350_Plot, RSI_MA_350(3,3).RSI_Plot, 1) && RSI(3,3)[0]<20 )
                {
                    EnterLong(DefaultQuantity, "");
                }
    I would suggest you watch the following video as it explains what the && and || operations are. They are ways of linking conditions based on logic.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much, I was completely off. thank you...

      Comment


        #4
        Hi again,

        I tried using the && function as suggested with RSI and and RSI_MA_350 but as soon as I add the code the strategy does not place any trades. I can see that the conditions have been met but no trades are placed.

        I have attached the strategy and the indicator used, thanks for your help with this, I have been trying to get it right since 7am...

        Ryan


        Originally posted by NinjaTrader_AdamP View Post
        mccallum,

        Please find an example below.

        Code:
                    // Condition set 1
                    if ( CrossBelow(RSI_MA_350(3, 3).RSI_Plot, RSI_MA_350(3,3). RSI_MA_350_Plot, 1) && RSI(3,3)[0]>80 )							
                    {
                        EnterShort(DefaultQuantity, "");
                    }
        
                    // Condition set 2
                    if ( CrossAbove(RSI_MA_350(3, 3).RSI_MA_350_Plot, RSI_MA_350(3,3).RSI_Plot, 1) && RSI(3,3)[0]<20 )
                    {
                        EnterLong(DefaultQuantity, "");
                    }
        I would suggest you watch the following video as it explains what the && and || operations are. They are ways of linking conditions based on logic.

        http://www.youtube.com/watch?v=JZpo01eSO9c
        Attached Files

        Comment


          #5
          mccallum,

          It could be that the way I referenced the RSI is accessing a different plot than the one you wanted. I would suggest trying the following instead.

          Code:
                      // Condition set 1
                      if ( CrossBelow(RSI_MA_350(3, 3).RSI_Plot, RSI_MA_350(3,3). RSI_MA_350_Plot, 1) && RSI(3,3).RSI_Plot[0]>80 )							
                      {
                          EnterShort(DefaultQuantity, "");
                      }
          
                      // Condition set 2
                      if ( CrossAbove(RSI_MA_350(3, 3).RSI_MA_350_Plot, RSI_MA_350(3,3).RSI_Plot, 1) && RSI(3,3).RSI_Plot[0]<20 )
                      {
                          EnterLong(DefaultQuantity, "");
                      }
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Hi,

            I get a CS106 compile error when I add that code.

            I have No idea what to do to get this fixed..

            Comment


              #7
              mccallum,

              It looks like Joydeep has a ticket from you that you sent in to our support email. He will continue to work with you there.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Adam,

                Comment

                Latest Posts

                Collapse

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