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

Modified RSI Alert

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

    Modified RSI Alert

    I need assistance with an alert for a modified RSI. I want to create an alert that sets off when the RSI hits 70. When I use the stock RSI indicator of 14 periods, 3 smoothing, and I use this alert, then it works as expected:

    RSITarget = 70;
    PlayAlert = true;
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (RSI(14, 3).Avg[0] >= RSITarget
    && PlayAlert == true)
    {
    Alert("MyAlert3", Priority.High, "RSI > 70", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert1.wav", 5, Color.White, Color.Black);
    }
    }


    Then, all works as expected. Now, when I use the RSI indicators of 7 periods, 3 smoothing, and I use this alert, it fails.

    RSIAlert = 70;
    TriggerAlarm = true;
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (RSI(7, 3).Avg[0] == RSIAlert
    && TriggerAlarm == true)
    {
    Alert("MyAlert0", Priority.High, "Set Up", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert1.wav", 0, Color.White, Color.Black);
    }
    }


    Any notion of where my fault is? Thanks for your help.

    #2
    Your second condition is looking for when it is exactly 70, not greater than or equal to as the first condition.

    Try using >= for your second condition check

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,606 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    8 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    13 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X