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 helpwanted, Today, 03:06 AM
    1 response
    10 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    9 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    387 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X