Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RSI coding help

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

    RSI coding help

    I need help figuring out the logic of

    If RSI during the past 20 bars is >80
    And SMA[0] <= SMA[1]

    then sell

    I can't figure out how to set the RSI over the past xx bars in the strategy wizard.

    If this needs to be coded outside of the wizard, what would the code look like?

    Thanks!
    Mike

    #2
    Hello Mike,

    Thank you for your note.

    You would need to use CountIf() outside of the Strategy Wizard. Like the following:
    Code:
    			if(SMA(20)[0] <= SMA(20)[1]
    				&& CountIf(delegate {return RSI(20, 3)[0] > 80;}, 20) == 20)
    			{
    				// do something
    			}
    For information on CountIf() please visit the following link: http://www.ninjatrader.com/support/h...t7/countif.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Ok I understand that, but i'm a little confused on what all the numbers mean. For example, if I wanted the RSI period to be 10, where would that go? I'm assuming the 20) == 20) indicates the 20 bars back, correct?

      Comment


        #4
        Hello Mike,

        That is correct.

        Comment


          #5
          Does using the Countif code prevent the use of backtesting in the strategy analyzer?

          I have complied with no errors and I am getting no trades in a 1 year period.

          Comment


            #6
            Hello mreisinger,

            Thank you for your response.

            May we test your strategy on our end? If so, please send to platformsupport[at]ninjatrader[dot]com with this thread in the subject line 'http://www.ninjatrader.com/support/forum/showthread.php?t=70629' and 'ATTN: Patrick - 1211062' in the body of the e-mail.

            You can export your strategy by going to File > Utilities > Export NinjaScript, make sure to export as source files. Information on Export NinjaScript can be found at the following link: http://www.ninjatrader.com/support/h...nt7/export.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DayTradingDEMON, Today, 09:28 AM
            3 responses
            19 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Stanfillirenfro, Today, 07:23 AM
            9 responses
            23 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by George21, Today, 10:07 AM
            0 responses
            8 views
            0 likes
            Last Post George21  
            Started by navyguy06, Today, 09:28 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            8 responses
            34 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X