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 kempotrader, Today, 08:56 AM
    0 responses
    6 views
    0 likes
    Last Post kempotrader  
    Started by kempotrader, Today, 08:54 AM
    0 responses
    4 views
    0 likes
    Last Post kempotrader  
    Started by mmenigma, Today, 08:54 AM
    0 responses
    2 views
    0 likes
    Last Post mmenigma  
    Started by halgo_boulder, Today, 08:44 AM
    0 responses
    1 view
    0 likes
    Last Post halgo_boulder  
    Started by drewski1980, Today, 08:24 AM
    0 responses
    4 views
    0 likes
    Last Post drewski1980  
    Working...
    X