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

Indicator Not Plotting

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

    Indicator Not Plotting

    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class highVR : Indicator
    {
    #region Variables
    // Wizard generated variables
    private double vR1 = 1.7; // Default setting for VR1
    private double vR2 = 1.3; // Default setting for VR2
    // User defined variables (add any user defined variables below)
    #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.Black), PlotStyle.Bar, "Plot0"));
    Overlay = false;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Set the value
    Plot0.Set(High[0] > High[1]
    && Low[0] > Low[1]
    && Close[0] > Close[1]
    && Close[0] > Open[0]
    && Volume[0] > Volume[1] * VR1
    && Volume[0] > Volume[2] * VR2? 1 : 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("")]
    [GridCategory("Parameters")]
    public double VR1
    {
    get { return vR1; }
    set { vR1 = Math.Max(1, value); }
    }

    [Description("")]
    [GridCategory("Parameters")]
    public double VR2
    {
    get { return vR2; }
    set { vR2 = Math.Max(1, value); }
    }
    #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 highVR[] cachehighVR = null;

    private static highVR checkhighVR = new highVR();

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public highVR highVR(double vR1, double vR2)
    {
    return highVR(Input, vR1, vR2);
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public highVR highVR(Data.IDataSeries input, double vR1, double vR2)
    {
    if (cachehighVR != null)
    for (int idx = 0; idx < cachehighVR.Length; idx++)
    if (Math.Abs(cachehighVR[idx].VR1 - vR1) <= double.Epsilon && Math.Abs(cachehighVR[idx].VR2 - vR2) <= double.Epsilon && cachehighVR[idx].EqualsInput(input))
    return cachehighVR[idx];

    lock (checkhighVR)
    {
    checkhighVR.VR1 = vR1;
    vR1 = checkhighVR.VR1;
    checkhighVR.VR2 = vR2;
    vR2 = checkhighVR.VR2;

    if (cachehighVR != null)
    for (int idx = 0; idx < cachehighVR.Length; idx++)
    if (Math.Abs(cachehighVR[idx].VR1 - vR1) <= double.Epsilon && Math.Abs(cachehighVR[idx].VR2 - vR2) <= double.Epsilon && cachehighVR[idx].EqualsInput(input))
    return cachehighVR[idx];

    highVR indicator = new highVR();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    #if NT7
    indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
    indicator.MaximumBarsLookBack = MaximumBarsLookBack;
    #endif
    indicator.Input = input;
    indicator.VR1 = vR1;
    indicator.VR2 = vR2;
    Indicators.Add(indicator);
    indicator.SetUp();

    highVR[] tmp = new highVR[cachehighVR == null ? 1 : cachehighVR.Length + 1];
    if (cachehighVR != null)
    cachehighVR.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cachehighVR = tmp;
    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>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.highVR highVR(double vR1, double vR2)
    {
    return _indicator.highVR(Input, vR1, vR2);
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public Indicator.highVR highVR(Data.IDataSeries input, double vR1, double vR2)
    {
    return _indicator.highVR(input, vR1, vR2);
    }
    }
    }

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public partial class Strategy : StrategyBase
    {
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.highVR highVR(double vR1, double vR2)
    {
    return _indicator.highVR(Input, vR1, vR2);
    }

    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    /// <returns></returns>
    public Indicator.highVR highVR(Data.IDataSeries input, double vR1, double vR2)
    {
    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.highVR(input, vR1, vR2);
    }
    }
    }
    #endregion

    #2
    Before I read all that.....

    Have you checked the log?

    What does it say?
    Attached Files
    Last edited by Crassius; 02-02-2013, 08:53 AM.

    Comment


      #3
      It wont even show up in the indicator list now..

      Comment


        #4
        Find the file in your system that contains indicators by using the highlighted path in teh attached screenshot.... yours will be a very similar path but not exactly...

        Find the indicator file by its name dot cs.

        If it isn't in this file, use your operating systems search feature to find the indcicator name dot cs file....
        Attached Files

        Comment


          #5
          Ok, I found the folder with my indicator in it.

          Comment


            #6
            If it is in the bin/custom/indicator folder, then it must be in the indicator list....

            If it isn't i that folder, move it there, try to apply it to a chart, and tell us what the log says.... when/if if fails to plot...

            Comment


              #7
              Originally posted by Crassius View Post
              If it is in the bin/custom/indicator folder, then it must be in the indicator list....

              If it isn't i that folder, move it there, try to apply it to a chart, and tell us what the log says.... when/if if fails to plot...

              Also, you may need to compile an indicator.... any indicator in the bin/custom/indicator folder to get your indicator to show up in the indicator list...

              pick one of the NT system indicators like ADX, compile it with your indicator in the correct folder, and your indicator will appear in the indicator list....

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              1 view
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              238 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              383 views
              1 like
              Last Post Gavini
              by Gavini
               
              Started by oviejo, Today, 12:28 AM
              0 responses
              1 view
              0 likes
              Last Post oviejo
              by oviejo
               
              Started by pechtri, 06-22-2023, 02:31 AM
              10 responses
              125 views
              0 likes
              Last Post Leeroy_Jenkins  
              Working...
              X