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 CarlTrading, 03-31-2026, 09:41 PM
                  1 response
                  67 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by CarlTrading, 04-01-2026, 02:41 AM
                  0 responses
                  36 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CaptainJack, 03-31-2026, 11:44 PM
                  0 responses
                  59 views
                  1 like
                  Last Post CaptainJack  
                  Started by CarlTrading, 03-30-2026, 11:51 AM
                  0 responses
                  62 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CarlTrading, 03-30-2026, 11:48 AM
                  0 responses
                  53 views
                  0 likes
                  Last Post CarlTrading  
                  Working...
                  X