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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    155 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    137 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    130 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X