Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACDBBLines

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

    #31
    I see. Unfortunately this indicator you speak of is not a NinjaTrader indicator so I can't provide support for it since I don't know how this indicator operates and if you can even check for the condition you speak of. You would need to go back to the author of the indicator and ask them.
    RayNinjaTrader Customer Service

    Comment


      #32
      thanks Ray for looking at it, for more infor please look at eSignal Central Forum. that was written using the Formula Wizard.

      Comment


        #33
        When I was trying to figure out how MACDBBLines worked, I added a few, sparse comments to it that may help.

        It's not up to my usual level of commenting, but it still may help.

        I've attached a copy for your perusal.
        Attached Files

        Comment


          #34
          Originally posted by KBJ View Post
          When I was trying to figure out how MACDBBLines worked, I added a few, sparse comments to it that may help.

          It's not up to my usual level of commenting, but it still may help.

          I've attached a copy for your perusal.
          How do I access the comments as they only show a snippet on the indicator?

          Regards

          Comment


            #35
            I'm not sure I understand the question.

            The comments I was talking about are embedded in the source code. A source code comment in C# (or NinjaScript) begins with "//" and runs to the end of the line.

            For instance, the following line shows one of the comments that I added to MACDBBLines.cs:

            Code:
            // Draw a big yellow dot over the zero line intersection.
            A comment is not understood by the source code compiler and is ignored (has no effect on the operation of the program.)

            A comment's only use is for notations by the programmer for later reference by himself/herself or others who are trying to understand the code.

            Comment


              #36
              To view the code and see these comments you will need to open up the indicator source file. This can be done by going through the NinjaScript editor.

              Tools->Edit NinjaScript->Indicator->select the indicator file->Open
              Josh P.NinjaTrader Customer Service

              Comment


                #37
                Hi Josh
                I have a no programming experience could you provide a sample script or code with “BB Macd”, so I can incorporate it into my script for backtesting . I tried the wizard with no results.
                I would greatly appreciate it

                Comment


                  #38
                  Sorry gary9. I am unfamiliar with how a trader would use the MACDBB to trade so I would not be able to generate a worthwhile sample for its utilization.

                  Here are some brief examples of how you would call Gumphrie's MACDBBLines indicator though. You will need to figure out workable trading conditions on your own.
                  Code:
                  if (CrossAbove(MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand, 0, 1))
                  {
                       // Do something
                  }
                  Code:
                  MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand
                  is one of the lines and the other line is [/code]MACDBBLines(12, 10, 26, 5, 1).BB_LowerBand[/code]
                  To get their individual values and compare them to something you could do something like
                  Code:
                  if (MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand[0] > someThresholdValue)
                  {
                       // Do something
                  }
                  Hope that helps.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #39
                    Originally posted by gary9 View Post
                    thanks Ray for looking at it, for more infor please look at eSignal Central Forum. that was written using the Formula Wizard.
                    http://forum.esignalcentral.com/show...?threadid=7271
                    I think the code here is virtually identical, if not the same, to the code I used to create MACDBBLines.

                    Comment


                      #40
                      Josh or Gumphrie,

                      How would I code the MACD (dots) for when they were (started) inside the upper and lower bands and then closed above the .BB_UpperBands? to enter a long and then exit the long when it closed back inside the .BB_UpperBands?. Visa versa for a short?
                      I tried using your examples below but just cant figure out how to code the MACD cross above/below or the greater/less than the BB_UpperBands or BB_LowerBands.

                      if (CrossAbove(MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand, 0, 1))
                      {
                      // Do something
                      }

                      OR

                      if (MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand[0] > someThresholdValue)
                      {
                      // Do something
                      }

                      I tried some things like:
                      if (bbMacd[0] > MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand[0])
                      {
                      // Do something
                      }

                      and cant get anything to compile.
                      Any help would be apreciated.

                      Thanks

                      Comment


                        #41
                        Originally posted by dwalls View Post
                        I tried some things like:
                        if (bbMacd[0] > MACDBBLines(12, 10, 26, 5, 1).BB_UpperBand[0])
                        {
                        // Do something
                        }

                        and cant get anything to compile.
                        bbMacd is an internal Dataseries variable to the indicator, to get that value in your code you would call the MACD directly.

                        Comment


                          #42
                          And here's how you'd do that.

                          Try this equivalent code...

                          Code:
                          double UpperBand = EMA(MACD(10,26,5),12)[0] 
                                        + StdDev(MACD(10,26,5),12)[0];
                          
                          if (MACD(10, 26, 5)[0] > UpperBand)
                          {
                             // Do something
                          }
                          Last edited by KBJ; 11-05-2007, 10:47 AM. Reason: Corrected compile error in posted code

                          Comment


                            #43
                            Error on generating Strategy

                            Copy and paste into: NinjaTrader.Strategy
                            'NinjaTrader.Indicator.MACD' does not contain a definition for 'MACD'
                            #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.Strategy;
                            #endregion
                            // This namespace holds all strategies and is required. Do not change it.
                            namespace NinjaTrader.Strategy
                            {
                            ///<summary>
                            ///
                            ///</summary>
                            [Description("")]
                            [Gui.Design.DisplayName(
                            "bbm")]
                            publicclass bbm : Strategy
                            {
                            #region Variables
                            // Wizard generated variables
                            // User defined variables (add any user defined variables below)
                            #endregion
                            ///<summary>
                            /// This method is used to configure the strategy and is called once before any strategy method is called.
                            ///</summary>
                            protectedoverridevoid Initialize()
                            {
                            CalculateOnBarClose =
                            true;
                            SetProfitTarget(
                            "", CalculationMode.Ticks, 8);
                            SetStopLoss(
                            "", CalculationMode.Ticks, 8, false);

                            }
                            ///<summary>
                            /// Called on each bar update event (incoming tick)
                            ///</summary>
                            protectedoverridevoid OnBarUpdate()
                            {
                            double UpperBand = EMA(MACD(10,26,5).Macd,12)[0]
                            + StdDev(MACD(
                            10,26,5).Macd,12)[0];
                            if (MACD(10, 26, 5)[0] > UpperBand)
                            {
                            // Do something
                            EnterLong(DefaultQuantity, "");
                            }

                            }
                            #region Properties
                            #endregion
                            }
                            }



                            Comment


                              #44
                              My apologies, I was a little too quick with the solution there.

                              Check it again, I've corrected the error in my earlier post. (And this time I test-compiled it.)

                              Comment


                                #45
                                Hi KBJ

                                Thanks for the code.
                                I'm trying to duplicate the MACDBB in the MACDBBLines indicator.
                                i added
                                && MACD(10, 26, 5)[1] < UpperBand)
                                but the action was off. Apreciate further progress in making this a automated trading strategy.
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by algospoke, Today, 06:40 PM
                                0 responses
                                10 views
                                0 likes
                                Last Post algospoke  
                                Started by maybeimnotrader, Today, 05:46 PM
                                0 responses
                                8 views
                                0 likes
                                Last Post maybeimnotrader  
                                Started by quantismo, Today, 05:13 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post quantismo  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                8 responses
                                169 views
                                0 likes
                                Last Post jeronymite  
                                Started by cre8able, Today, 04:22 PM
                                0 responses
                                10 views
                                0 likes
                                Last Post cre8able  
                                Working...
                                X