Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom indicator

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

    Custom indicator

    I'm building a custom indicator that uses an existing indicator but I can't figure what I'm doing wrong. Here's a sample:

    DataSeries myData=new DataSeries(This);
    myData.Set(Close[0]-Close[1]);
    double modifiedRSI=RSI(myData,3,1)[0];

    Plot0.Value(modifiedRSI);
    Last edited by d.allen101; 01-04-2010, 02:47 PM.

    #2
    Hello D. Allen,

    Thank you for your post.

    I was able to take your code and plot the indicator. Things need to be moved around and you have to add a condition to check that there are enough bars to construct.

    In the variables region:
    Code:
     
    private DataSeries myData;
    private double modifiedRSI;
    In the initialize method:
    Code:
    myData = new DataSeries(this);
    In the OnBarUpdate method:
    Code:
     
    if(CurrentBar <= 10)
    return;
     
    myData.Set(Close[0] - Close[1]);
    double modifiedRSI = RSI(myData,3,1)[0]; 
     
     
    [SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]Plot0.Set(modifiedRSI); [/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE]

    Last edited by NinjaTrader_RyanM1; 01-04-2010, 04:15 PM.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    331 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X