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

Paintbar - Doji Star

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

    #16
    Originally posted by McClellan View Post
    That makes sense, but there are no inputs. The code for the indicator is attached.



    Actually, you have the opposite problem in this case. Your indicator has no outputs, as all of your entities are declared as private, so you cannot access any output, including the indicator itself, from any other class.

    Comment


      #17
      Ok, I changed the following lines:

      //added by MM - to allow patterns to be incorporated into strategy
      public BoolSeries BearishEngulfingFound;
      public BoolSeries BullishEngulfingFound;

      Still no workie.

      The indicator was already set to public.

      publicclass CandleStickPatternAll : Indicator

      Comment


        #18
        Originally posted by McClellan View Post
        Ok, I changed the following lines:

        //added by MM - to allow patterns to be incorporated into strategy
        public BoolSeries BearishEngulfingFound;
        public BoolSeries BullishEngulfingFound;

        Still no workie.

        The indicator was already set to public.

        publicclass CandleStickPatternAll : Indicator
        A method can be exposed by simply declaring it public. A BoolSeries is an object: you have to expose it using a property definition.

        Here is an example: http://www.ninjatrader.com/support/f...ead.php?t=4991

        Comment


          #19
          Understood. Added the following code to the indicator:

          [Browsable(false)]
          [XmlIgnore()]
          public BoolSeries bullishEngulfingFound
          {
          get { return BullishEngulfingFound; } // Allows our public BearIndication BoolSeries to access and expose our internal bearIndication BoolSeries
          }

          [Browsable(
          false)]
          [XmlIgnore()]
          public BoolSeries bearishEngulfingFound
          {
          get { return BearishEngulfingFound; } // Allows our public BullIndication BoolSeries to access and expose our internal bullIndication BoolSeries
          }

          [Browsable(
          false)]
          [XmlIgnore()]
          publicdouble ExposedVariable
          {
          // We need to call the Update() method to ensure our exposed variable is in up-to-date.
          get { Update(); return exposedVariable; }
          }


          And to the strategy:

          protectedoverridevoid OnBarUpdate()
          {
          if (CandleStickPatternAll().BullishEngulfingFound[0])
          EnterLong();
          if (CandleStickPatternAll().BearishEngulfingFound[0])
          EnterShort();
          Print(CandleStickPatternAll().ExposedVariable);
          }

          Compile errors are in the strategy, at the above 3 lines. Can't figure out why.

          Comment


            #20
            I notice that in your Indicator code, you have no "using" directives. Do you have any in your Strategy code?

            Comment


              #21
              I don't think I do, unless the strategy builder put them in automatically.

              Comment


                #22
                Would this make a difference?

                Comment


                  #23
                  Here is what the using region looks like in the strategy:

                  #region Using declarations
                  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.Indicator;
                  using NinjaTrader.Gui.Chart;
                  using NinjaTrader.Strategy;
                  #endregion

                  Comment


                    #24
                    Originally posted by McClellan View Post
                    Here is what the using region looks like in the strategy:

                    #region Using declarations
                    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.Indicator;
                    using NinjaTrader.Gui.Chart;
                    using NinjaTrader.Strategy;
                    #endregion
                    At this point, I think I will have to load up the files on my own machine, if I am to see what is happening, as I cannot see anything obviously defective. The matter does not seem to be any secret, so maybe you could just post the files that you are using, and let me see if I can nail the problem?

                    Comment


                      #25
                      That would be great. Can I get some instructions on how to do that? I tried to "export ninjascript" and it says "You have files with programming errors. You must resolve these programming errors before you can export a ninjascript."

                      Comment


                        #26
                        Originally posted by McClellan View Post
                        That would be great. Can I get some instructions on how to do that? I tried to "export ninjascript" and it says "You have files with programming errors. You must resolve these programming errors before you can export a ninjascript."
                        Do not export. You cannot export if any file(s) in your tree have errors. Just post the .cs files. They are what we are trying to correct.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Segwin, 05-07-2018, 02:15 PM
                        14 responses
                        1,788 views
                        0 likes
                        Last Post aligator  
                        Started by Jimmyk, 01-26-2018, 05:19 AM
                        6 responses
                        837 views
                        0 likes
                        Last Post emuns
                        by emuns
                         
                        Started by jxs_xrj, 01-12-2020, 09:49 AM
                        6 responses
                        3,293 views
                        1 like
                        Last Post jgualdronc  
                        Started by Touch-Ups, Today, 10:36 AM
                        0 responses
                        13 views
                        0 likes
                        Last Post Touch-Ups  
                        Started by geddyisodin, 04-25-2024, 05:20 AM
                        11 responses
                        63 views
                        0 likes
                        Last Post halgo_boulder  
                        Working...
                        X