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 ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    44 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    20 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    180 views
    0 likes
    Last Post jeronymite  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Working...
    X