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 Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  672 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  379 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  577 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  582 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X