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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    29 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    15 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    18 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X