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 love2code2trade, Yesterday, 01:45 PM
            4 responses
            28 views
            0 likes
            Last Post love2code2trade  
            Started by funk10101, Today, 09:43 PM
            0 responses
            7 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            45 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Working...
            X