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

RSI I tried to create ends up with value=trade prices

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

    RSI I tried to create ends up with value=trade prices

    I just joined and wanted an RSI with no Avg because it hides the RSI value on the price axis and I wanted a 50 line drawn.
    I tried creating my own and it sort of did it except my price axis isnt returning 0-100 its matching the ES symbol values near 1000 today.

    I had no problem coding a lot fot my tradestation charts, but this I cant figure out yet.
    HELP.
    Thanks.
    I am posting what I got from ninja's create RSI with all the items expanded to be visible.

    PHP Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    #endregion
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    [Description("The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg ")]
    public class 
    RSImine Indicator
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 21// Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    private DataSeries avgUp;
    private 
    DataSeries avgDown;
    private 
    DataSeries down;
    private 
    int period 21;
     
    #endregion
    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line"Plot0"));
    Add(new Line(System.Drawing.Color.DarkViolet50"Mid"));
    CalculateOnBarClose false;
     
    PriceTypeSupported true;
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    Plot0.Set(Close[0]);
    }
    #region Properties
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Plot0
    {
    get { return Values[0]; }
    }
    [
    Description("")]
    [
    Category("Parameters")]
    public 
    int MyInput0
    {
    get { return myInput0; }
    set myInput0 Math.Max(1value); }
    }
    #endregion
    }
    }
    #region NinjaScript generated code. Neither change nor remove.
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    public 
    partial class Indicator IndicatorBase
    {
    private 
    RSImine[] cacheRSImine null;
    private static 
    RSImine checkRSImine = new RSImine();
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    public RSImine RSImine(int myInput0)
    {
    return 
    RSImine(InputmyInput0);
    }
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    public RSImine RSImine(Data.IDataSeries inputint myInput0)
    {
    checkRSImine.MyInput0 myInput0;
    myInput0 checkRSImine.MyInput0;
    if (
    cacheRSImine != null)
    for (
    int idx 0idx cacheRSImine.Lengthidx++)
    if (
    cacheRSImine[idx].MyInput0 == myInput0 && cacheRSImine[idx].EqualsInput(input))
    return 
    cacheRSImine[idx];
    RSImine indicator = new RSImine();
    indicator.BarsRequired BarsRequired;
    indicator.CalculateOnBarClose CalculateOnBarClose;
    indicator.Input input;
    indicator.MyInput0 myInput0;
    indicator.SetUp();
    RSImine[] tmp = new RSImine[cacheRSImine == null cacheRSImine.Length 1];
    if (
    cacheRSImine != null)
    cacheRSImine.CopyTo(tmp0);
    tmp[tmp.Length 1] = indicator;
    cacheRSImine tmp;
    Indicators.Add(indicator);
    return 
    indicator;
    }
    }
    }
    // This namespace holds all market analyzer column definitions and is required. Do not change it.
    namespace NinjaTrader.MarketAnalyzer
    {
    public 
    partial class Column ColumnBase
    {
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public 
    Indicator.RSImine RSImine(int myInput0)
    {
    return 
    _indicator.RSImine(InputmyInput0);
    }
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    public Indicator.RSImine RSImine(Data.IDataSeries inputint myInput0)
    {
    return 
    _indicator.RSImine(inputmyInput0);
    }
    }
    }
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public 
    partial class Strategy StrategyBase
    {
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public 
    Indicator.RSImine RSImine(int myInput0)
    {
    return 
    _indicator.RSImine(InputmyInput0);
    }
    /// <summary>
    /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. Input period=14 and a midline=50 and no Avg 
    /// </summary>
    /// <returns></returns>
    public Indicator.RSImine RSImine(Data.IDataSeries inputint myInput0)
    {
    if (
    InInitialize && input == null)
    throw new 
    ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
    return 
    _indicator.RSImine(inputmyInput0);
    }
    }
    }
    #endregion 
    Last edited by simpletrades; 08-03-2009, 02:41 PM.

    #2
    simpletrades,

    You're indicator plots the closing price and nothing else. You need to actually use the RSI logic inside the OnBarUpdate() method to plot RSI.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      simpletrades,

      You're indicator plots the closing price and nothing else. You need to actually use the RSI logic inside the OnBarUpdate() method to plot RSI.
      Thanks that suggestion created 2 errors repeated over and over after I copied and pasted, but I just needed to paste more lines from the variable section and then replace 'Period' with 'myInput0'

      Its fine now. Thanks

      Comment


        #4
        Thanks my next project is a paintbar I wrote for my tradestation charts.
        When 3 indicators are all above their midline and MACD is greater than its Avg, the bars are blue.
        If the 3 are below the midline and mACD is under its Avg the bars are pink.
        If at least one is different the bars are gray.
        All are available on Ninja.
        Here is a screenshot of the ES 6/24.
        Any takers?
        Attached Files
        Last edited by simpletrades; 08-03-2009, 04:05 PM.

        Comment


          #5
          Best if you put this request in a new thread so people can find it easier. Also, if you want you may consider one of these 3rd party NinjaScript Consultants to create this for you professionally: http://www.ninjatrader.com/webnew/pa...injaScript.htm
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ntram, Yesterday, 05:39 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by bmarovets, Yesterday, 06:33 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by FishTrade, Yesterday, 03:42 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by giulyko00, Yesterday, 11:49 AM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by ttrader23, Yesterday, 09:04 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X