• 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

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, 06: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:

    https://ninjatrader.com/support/help...ustomevent.htm

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    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 lavalampmj, Today, 05:25 PM
        0 responses
        1 view
        0 likes
        Last Post lavalampmj  
        Started by Antares66, Today, 05:19 PM
        0 responses
        2 views
        0 likes
        Last Post Antares66  
        Started by jmneto, Today, 05:18 PM
        0 responses
        2 views
        0 likes
        Last Post jmneto
        by jmneto
         
        Started by Bobbyj78, Today, 02:21 PM
        2 responses
        12 views
        0 likes
        Last Post bltdavid  
        Started by EnveousColnago, Today, 02:10 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Ariana  
        Working...
        X