Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add RSI indicator in Strategy in NinjaTrader8

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

    How to add RSI indicator in Strategy in NinjaTrader8

    Dear Team!

    I want add a condition :RSI >70 to my strategy.My logic is that,if the RSI is greater than 70,short will be triggered.

    I tried this way:

    if (State == State.DataLoaded)
    {
    AddChartIndicator(RSI(14, 1));
    }


    private void SetEntrySignal()
    {
    if (CrossAbove(RSI(14, 1), 30, 1))

    {
    _enterShort = Close[0] < Open[0];
    _enterShort &= Open[0] < Low[1];
    }
    }
    I also tried this:

    private void SetEntrySignal()
    {
    if (RSI(14, 1) > 70)
    { _enterShort = Close[0] < Open[0];
    _enterShort &= Open[0] < Low[1];
    }
    }
    But this still now work.Can you show me the correct way directly,I have read the document already ,but have no idea how to solve.Thank you so much!
    Last edited by williamzz; 06-20-2019, 07:17 PM.

    #2
    Hello williamzz,

    Thank you for your post.

    It looks like you are trying to get the current value of Close[0], Open[0], and Low[1] inside your custom event method. If you need to obtain a value like Close[0] value outside of one of the core data event methods, you can use TriggerCustomEvent() to reliably synchronize the barAgo indexer to the current bar being updated. Please see the example from our help guide below:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Sorry,could you read my question again.now I've made it more clearly to read.What I need is adding RSI indicator to Strategy,not get the current value of Close[0], Open[0].I think TriggerCustomEvent is more complicated.I just need a logic that,if the value of the RSI is higher than 70 I will short it.So can you give me more advice .Really appreciate it!

      Comment


        #4
        Issue solved.Thanks!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        19 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        119 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X