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

Display value from Market Analyzer column to chart as text

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

    Display value from Market Analyzer column to chart as text

    Hi, I have this code for an indicator, that should display a value from a column on the Market Analyzer onto a chart.
    The code is still in development, but I got stuck on line 48 (notes2 = MarketAnalyzer.CurrentInstrument.FullName, as the compiler gives me error mesage code CS0103:

    Code:
    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Forms;
    using System.Xml.Serialization;
    using System.Drawing;
    using NinjaTrader.Core;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.DrawingTools;
    using NinjaTrader.NinjaScript.Strategies;
    #endregion
    
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
        public class Noteonchart : Indicator
        {
          private string notes2;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Displays a note from Market Analyzer onto chart";
                    Name                                        = "Note on chart";
    
                }        
            }
    
            protected override void OnBarUpdate()
            {
            // Get the value from the Market Analyzer's Notes 2 column
                 notes2 = MarketAnalyzer.CurrentInstrument.FullName;
    
    
    
    
            // Display the value on the chart
            Draw.Text(this, "Notes2", notes2, 0, Low[0] - (TickSize * 10));
            }            
    
            }
    
    }
    
    #region NinjaScript generated code. Neither change nor remove.
    
    namespace NinjaTrader.NinjaScript.Indicators
    {
        public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
        {
            private Noteonchart[] cacheNoteonchart;
            public Noteonchart Noteonchart()
            {
                return Noteonchart(Input);
            }
    
            public Noteonchart Noteonchart(ISeries<double> input)
            {
                if (cacheNoteonchart != null)
                    for (int idx = 0; idx < cacheNoteonchart.Length; idx++)
                        if (cacheNoteonchart[idx] != null &&  cacheNoteonchart[idx].EqualsInput(input))
                            return cacheNoteonchart[idx];
                return CacheIndicator<Noteonchart>(new Noteonchart(), input, ref cacheNoteonchart);
            }
        }
    }
    
    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
        public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
        {
            public Indicators.Noteonchart Noteonchart()
            {
                return indicator.Noteonchart(Input);
            }
    
            public Indicators.Noteonchart Noteonchart(ISeries<double> input )
            {
                return indicator.Noteonchart(input);
            }
        }
    }
    
    namespace NinjaTrader.NinjaScript.Strategies
    {
        public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
        {
            public Indicators.Noteonchart Noteonchart()
            {
                return indicator.Noteonchart(Input);
            }
    
            public Indicators.Noteonchart Noteonchart(ISeries<double> input )
            {
                return indicator.Noteonchart(input);
            }
        }
    }
    
    #endregion
    ​
    Hope it is possible to access data from the Market Analyzer according to the linked instrument or any of the specified instruments on the Market Analyzer at all?

    Thanks
    Peter

    #2
    Hello cyberpete76,

    What data are you trying to access? You can't access the market analyzer directly to get data but you can in general get the data it uses. You can also view each of the columns code in the NinjaScript editor if you wanted to see how it collects data.

    JesseNinjaTrader Customer Service

    Comment


      #3
      I need to collect values I am typing into a column, which is a simple Note (Notes 2 from my screenshot, to be precise)
      Attached Files

      Comment


        #4
        Hello cyberpete76,

        There wouldn't be a way to pass that information to a chart, charts have no means of communicating with columns in the analyzer window. You can launch a chart from the analyzer to the instrument and that chart can have indicators on it but the only data shared between the analyzer and the chart would be the instrument and timeframe based on the linking settings. If you need notes in a chart you would need to use a notes indicator and type in notes to the chart instead of the analyzer.

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rene69851, 05-02-2024, 03:25 PM
        1 response
        20 views
        0 likes
        Last Post rene69851  
        Started by ETFVoyageur, Yesterday, 07:05 PM
        5 responses
        43 views
        0 likes
        Last Post ETFVoyageur  
        Started by jpeep, 08-16-2020, 08:31 AM
        13 responses
        487 views
        0 likes
        Last Post notenufftime  
        Started by realblubb, 04-28-2024, 09:28 AM
        2 responses
        32 views
        0 likes
        Last Post realblubb  
        Started by bmarovets, Today, 06:33 PM
        0 responses
        12 views
        0 likes
        Last Post bmarovets  
        Working...
        X