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:



    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 GLFX005, Today, 03:23 AM
        0 responses
        2 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        11 views
        0 likes
        Last Post XXtrader  
        Started by Waxavi, Today, 02:10 AM
        0 responses
        7 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        14 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        3 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Working...
        X