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

Multi Instrument script... problem indicator

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

    Multi Instrument script... problem indicator

    I am having a problem getting this indicator to plot. The horizontal lines won't even plot. I must be doing something wrong. I am trying to add together the closing prices of 3 market internals and have it plot as a line. Please see my code below. I have added to the code what I have found in the help file in a step by step fashion for example at first I did not have BarsRequired the CurrentBars check or the BarsInProgress and it did not plot I added these one by one and each step of the way it would not plot. This indicator is being applied to a chart of the NY52WN (JFNT.Z)
    HTML Code:
    [Description("The NYSE AMEX and NASDAQ 52 week new high-new low. ")]
    public class RC52WN : Indicator
    {
    #region Variables
    // Wizard generated variables
    // 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.DodgerBlue), PlotStyle.Line, "Combo52wn"));
    Add(new Line(Color.FromKnownColor(KnownColor.LimeGreen), 100, "Bullishline"));
    Add(new Line(Color.FromKnownColor(KnownColor.DarkGray), 0, "Zeroline"));
    Add(new Line(Color.FromKnownColor(KnownColor.Magenta), -100, "Bearishline"));
    Overlay = false;
    CalculateOnBarClose = false;
    Add("A52WN", PeriodType.Minute, 5);
    Add("Q52WN", PeriodType.Minute, 5);
    BarsRequired = 20;
    }
    /// <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.
     
    if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired)
    return;
    if (BarsInProgress == 0)
    {
    double Comboallthree = (Close[0] + Closes[1][0] + Closes[2][0]);
    Combo52wn.Set(Comboallthree);
    }
    }

    #2
    Blash, can you please also post your public properties for the plots? Any errors in your log tab as you apply the code to the chart?

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      HTML Code:
      #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 Combo52wn
      {
      get { return Values[0]; }
      }
      #endregion
      Please see the log error and instrument manager in the attached image. I have drawn arrows on the image. The error message in circled. The instrument is circled. The exchange in the editor is selected, default also, but it still says "<Select>" in the main Instrument Manager and if you were to click the left arrow to apply it to the default list you would get an error asking for you to select a exchange even though an exchange is selected. I feel this is the problem due to the error message in the log and it seems to be some sort of glich that I have experienced before but did not think to much of it. Please help and let me know if you need further clarification.
      Attached Files
      Last edited by Blash; 05-16-2011, 07:36 AM.

      Comment


        #4
        Thanks for the screenshots, please try calling your index instrument with a ^ in front of their name so

        Add("^A52WN", PeriodType.Minute, 5);
        Add("^Q52WN", PeriodType.Minute, 5);

        Would that work out then?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Yes great thanks that was what was wrong (the ^) many many thanks!!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Vikuno1, 11-28-2023, 11:42 PM
          15 responses
          357 views
          1 like
          Last Post PaulMohn  
          Started by PaulMohn, Yesterday, 02:06 AM
          3 responses
          12 views
          0 likes
          Last Post PaulMohn  
          Started by gertrudeabrams, Today, 12:33 AM
          0 responses
          3 views
          0 likes
          Last Post gertrudeabrams  
          Started by NJA_MC, 01-03-2021, 10:34 PM
          11 responses
          150 views
          0 likes
          Last Post wzgy0920  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          173 responses
          2,367 views
          0 likes
          Last Post jeronymite  
          Working...
          X