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

Newbie Indicator Question

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

    Newbie Indicator Question

    Hi,

    I'm trying to duplicate the RSI value in Amibroker as comparing them side by side seems to show some differences.

    I came up with the following that I _think_ is what I want, but I can't get the rsi value to plot out.....

    Any help greatly appreciated!

    John

    protectedoverridevoid OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    double P = 0.0;
    double N = 0.0;
    double W = 0.0;
    double S = 0.0;
    double diff = 0.0;
    double rsi_val = 0.0;

    diff = Close[
    0] - Close[1];
    if (diff > 0) {
    W = diff;
    }
    if (diff < 0) {
    S = -diff;
    }

    P = ((period -
    1) * P + W)/period;
    N = ((period -
    1) * N + S)/period;

    rsi_val =
    100*P/(P+N);

    Plot0.Set(rsi_val);
    }

    #2
    Please check the Control Center log for errors. Namely for the error discussed in this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    18 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Today, 09:46 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by wzgy0920, Today, 09:53 PM
    0 responses
    9 views
    0 likes
    Last Post wzgy0920  
    Started by Rapine Heihei, Today, 08:19 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 08:25 PM
    0 responses
    10 views
    0 likes
    Last Post Rapine Heihei  
    Working...
    X