Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:

    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 JTizz, Today, 03:32 PM
        1 response
        33 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by ebaydan777, Today, 02:41 PM
        1 response
        25 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by aligator, Today, 02:28 PM
        1 response
        25 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by daniel_weber8, Today, 01:21 PM
        1 response
        43 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by jungsoohuh, Today, 12:07 PM
        1 response
        35 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Working...
        X