Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator string output

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

    indicator string output

    Hallo to everyone

    I have a question.

    Is there a way to pass string output(not plot) created by an indicator, to a strategy ?

    #2
    voyager, it should be possible as long as the string variable is exposed to be accessed from the strategy (public property).

    Comment


      #3
      Thanks Bertrand

      You're right

      Comment


        #4
        Hallo again

        Continuing the above, i have a custom array created by a public class with a public constructor. When i declare the custom array as public, ninjatrader creates serialization error.

        What is wrong ?

        Comment


          #5
          voyager,

          Please be aware that this is beyond the level of support we can offer as this is much more advanced C# concepts.

          Please post exact code with the exact error message. Thank you.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Here is a simple and ready to use example.

            If this is working with ninjatrader 7 then there is no need to bother more.

            As i don't have ninjatrader 7 i would appreciate if anyone could check it out.

            Thanks




            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;

            namespace NinjaTrader.Indicator
            {
            [Description("")]
            public class JTest : Indicator
            {
            public INSTRdec[] InstrN = new INSTRdec[5] ;


            public class INSTRdec
            {
            public string Name ;
            public string Exc ;
            public INSTRdec(string Name, string Exc )
            {
            this.Name = Name ;
            this.Exc = Exc ;
            }

            }

            protected override void Initialize()
            {
            }

            protected override void OnBarUpdate()
            {
            InstrN[0] = new INSTRdec("","") ;
            }


            }
            }

            Comment


              #7
              If you compile with name "JTest"
              and insert it on a chart
              and then try to save workspace,

              it creates an error:
              indicator .... could not be serialized. Please refer help ... e.t.c

              Comment


                #8
                Unfortunately this is beyond what we provide support for. However, here is a hint: XML serialization is a .NET standard technology which comes with some clear restrictions on your code (please see MS docs). Also: you should be able to find lots of references on this issue on the forum.

                Comment


                  #9
                  Thank you. I'll check it

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by argusthome, Yesterday, 10:06 AM
                  0 responses
                  20 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  18 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  14 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  38 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X