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 kujista, Today, 06:23 AM
    4 responses
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by traderqz, Yesterday, 09:06 AM
    2 responses
    16 views
    0 likes
    Last Post traderqz  
    Started by traderqz, Today, 12:06 AM
    3 responses
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RideMe, 04-07-2024, 04:54 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by f.saeidi, Today, 08:13 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X