Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACDBBLines

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

    #46
    Why would you use "[1]" which is 1 bar ago, insead of "[0]" meaning the bar that just completed?

    Check to make sure the parameters are correct. I noticed when I converted the code snippet that dwalls wrote that the parameters were backwards. What I did earlier was just to convert the posted code, which does not match the defaults for MACDBBLines.

    You probably want MACD(12,26,5) which would match the defaults of the MACDBBLines indicator.

    Comment


      #47
      Hi dwalls

      How's it going, look like you're futher along in this project than me. Did you have any luck on getting anything to complie?
      If you get some spare time, could you please elaborate a little on the process. thanks.

      Comment


        #48
        Hello,

        Yes, I used Gumphrie's advice. This will work:

        // Condition set 1
        if (MACD(12, 26, 9)[0] > MACDBBLines(12, 9, 26, 5, 1).BB_UpperBand[0])


        {
        EnterLong(DefaultQuantity, "");
        }

        Comment


          #49
          Hello Gumphrie,
          I noticed that when I try to edit the "Smooth" Parameter in your "MacdBBLines" indicator it doesnt do anything. I dont know why.
          Could you take a look please.

          Also I found this version that someone made for eSignal last December.
          I thought I would include it for you to review to see if theres anything in there that may help to improve yours (not that it needs improvement).
          It does include the Macd value in the Data Box (cursor window) along with the upper and lower bands which is nice.

          Thanks

          var gUpperBoll = null;
          var gLowerBoll = null;
          var gMACD = null;
          var gTagID = null;
          function preMain() {
          setPriceStudy(false);
          setStudyTitle("DW_MACD_BB");
          setCursorLabelName("DW_MACD_UB",0);
          setCursorLabelName("DW_MACD",1);
          setCursorLabelName("DW_MACD_LB",2);
          setDefaultBarFgColor(Color.blue,0);
          setDefaultBarFgColor(Color.red,1);
          setDefaultBarFgColor(Color.blue,2);
          setPlotType(PLOTTYPE_LINE,0);
          setPlotType(PLOTTYPE_LINE,1);
          setPlotType(PLOTTYPE_LINE,2);
          setDefaultBarThickness(1,0);
          setDefaultBarThickness(1,1);
          setDefaultBarThickness(1,2);
          fp1 = new FunctionParameter( "MACD_FL", FunctionParameter.NUMBER);
          with(fp1) {
          setName("MACD Fast Length");
          setDefault(12);
          }
          fp2 = new FunctionParameter( "MACD_SL", FunctionParameter.NUMBER);
          with(fp2) {
          setName("MACD Slow Length");
          setDefault(26);
          }
          fp3 = new FunctionParameter( "MACD_SM", FunctionParameter.NUMBER);
          with(fp3) {
          setName("MACD Smoothing");
          setDefault(9);
          }
          fp4 = new FunctionParameter("Source", FunctionParameter.STRING);
          with(fp4) {
          fp4.setName("Source");
          fp4.addOption("Close");
          fp4.addOption("High");
          fp4.addOption("Low");
          fp4.addOption("Open");
          fp4.addOption("HL/2");
          fp4.addOption("HLC/3");
          fp4.addOption("OHLC/4");
          fp4.setDefault("Close"); //Edit this value to set a new default
          }
          fp5 = new FunctionParameter( "Boll_Length", FunctionParameter.NUMBER);
          with(fp5) {
          setName("Bollinger Length");
          setDefault(20);
          }
          fp6 = new FunctionParameter( "Boll_STD", FunctionParameter.NUMBER);
          with(fp6) {
          setName("Bollinger Standard Deviation");
          setDefault(2);
          }
          }

          function main(MACD_FL,MACD_SL,MACD_SM,Source,Boll_Length,Bo ll_STD){
          var dblMACD = null; // MACD value @ current bar
          var dblMACD_1 = null; // MACD value @ previous bar
          var dblUpperBoll = null; // Upper BB value
          var dblLowerBoll = null; // Lower BB value
          var strBasisColor = null; // Basis color
          var strCircleColor = null; // Circle Color
          // Instantiations of studies (done once)
          if (gMACD == null) {
          gMACD = macd(MACD_FL,MACD_SL,MACD_SM);
          gUpperBoll = upperBB(Boll_Length,Boll_STD,gMACD);
          gLowerBoll = lowerBB(Boll_Length,Boll_STD,gMACD);
          }
          // Rounding required to enable proper white circle assessment
          dblMACD = Math.round((gMACD.getValue(0))*10000)/10000;
          dblMACD_1 = Math.round((gMACD.getValue(-1))*10000)/10000;
          dblUpperBoll = Math.round((gUpperBoll.getValue(0))*10000)/10000;
          dblLowerBoll = Math.round((gLowerBoll.getValue(0))*10000)/10000;
          // MACD plot
          if (dblMACD > dblMACD_1) strCircleColor = "Color.green";
          else if (dblMACD == dblMACD_1) strCircleColor = "Color.white";
          else if (dblMACD < dblMACD_1) strCircleColor = "Color.red";
          drawShapeRelative(0, dblMACD, Shape.CIRCLE, null, eval(strCircleColor), Shape.ONTOP );
          // changes the color of the band based on the value of the MACD
          if (dblMACD >= 0) strBasisColor = "Color.green"; else strBasisColor = "Color.red";
          drawLineRelative(-1,0,0,0, PS_SOLID, 2, eval(strBasisColor),fnGetTagID());
          addBand(0,PS_SOLID,2,eval(strBasisColor),"0line");
          return new Array (dblUpperBoll,dblMACD,dblLowerBoll);
          }
          function fnGetTagID() {
          gTagID += 1;
          return gTagID;
          }
          Attached Files

          Comment


            #50
            Hi dwalls,

            Good point, the smooth parameter does effectively nothing / is unused because it is only used in the MACD call. The MACD itself uses it plot the 'Avg' plot, but as we don't have that in MACDBBLines, there is no use for it.
            So we can remove the parameter entirely if need be.

            Comment


              #51
              Hello,
              Here is an eSignal code that plots a diamond on the chart above or below a bar (candlestick) when the MacdBB close above or below the bollinger bands. Its called MacdBB Trendpoints.
              If someone has time could they please convert it to Ninjascript.
              It goes along with the eSignal code for the MacdBBLines below.
              Included is a snapshot of the parameters for both the MacdBB Trendpoints and the MacdBBLines. They are the same parameters. You would adjust the parameters of each one to match up with each other.

              Thanks

              var gUpperBoll = null;
              var gLowerBoll = null;
              var gMACD = null;
              var gbUP = false;
              var gbDOWN = false;
              function preMain() {
              setPriceStudy(true);
              setStudyTitle("DW_MACD_TrendPoints");
              setShowTitleParameters(false);
              setShowCursorLabel(false);
              fp1 = new FunctionParameter( "MACD_FL", FunctionParameter.NUMBER);
              with(fp1) {
              setName("MACD Fast Length");
              setDefault(12);
              }
              fp2 = new FunctionParameter( "MACD_SL", FunctionParameter.NUMBER);
              with(fp2) {
              setName("MACD Slow Length");
              setDefault(26);
              }
              fp3 = new FunctionParameter( "MACD_SM", FunctionParameter.NUMBER);
              with(fp3) {
              setName("MACD Smoothing");
              setDefault(9);
              }
              fp4 = new FunctionParameter("Source", FunctionParameter.STRING);
              with(fp4) {
              fp4.setName("Source");
              fp4.addOption("Close");
              fp4.addOption("High");
              fp4.addOption("Low");
              fp4.addOption("Open");
              fp4.addOption("HL/2");
              fp4.addOption("HLC/3");
              fp4.addOption("OHLC/4");
              fp4.setDefault("Close"); //Edit this value to set a new default
              }
              fp5 = new FunctionParameter( "Boll_Length", FunctionParameter.NUMBER);
              with(fp5) {
              setName("Bollinger Length");
              setDefault(20);
              }
              fp6 = new FunctionParameter( "Boll_STD", FunctionParameter.NUMBER);
              with(fp6) {
              setName("Bollinger Standard Deviation");
              setDefault(2);
              }
              }
              function main(MACD_FL,MACD_SL,MACD_SM,Source,Boll_Length,Bo ll_STD){
              var dblMACD = null; // MACD value @ current bar
              var dblUpperBoll = null; // Upper BB value
              var dblLowerBoll = null; // Lower BB value
              // Instantiations of studies (done once)
              if (gMACD == null) {
              gMACD = macd(MACD_FL,MACD_SL,MACD_SM);
              gUpperBoll = upperBB(Boll_Length,Boll_STD,gMACD);
              gLowerBoll = lowerBB(Boll_Length,Boll_STD,gMACD);
              }
              dblMACD = gMACD.getValue(0);
              dblUpperBoll = gUpperBoll.getValue(0);
              dblLowerBoll = gLowerBoll.getValue(0);
              // MACD plot
              if (dblMACD > dblUpperBoll) fnAlert("UP");
              else if (dblMACD < dblLowerBoll) fnAlert("DOWN");

              return null;
              }
              function fnAlert(pstrAlert) {
              if ((pstrAlert == "UP") && (gbUP == false)) {
              gbUP = true;
              gbDOWN = false;
              drawShape(Shape.DIAMOND,AboveBar1,Color.cyan);
              } else if ((pstrAlert == "DOWN") && (gbDOWN == false)) {
              gbDOWN = true;
              gbUP = false;
              drawShape(Shape.DIAMOND,BelowBar1,Color.magenta);
              }
              return null;
              }
              Attached Files

              Comment


                #52
                Something is wrong.

                Originally posted by Gumphrie View Post
                This is an indicator that plots the MACD and Bollinger bands worked out as a standard deviation from the MACD. It also highlights zero line crosses of the MACD line (displayed as dots).

                Any comments or strategy suggestions welcome.





                ChangeLog :

                Updated 21st August - Vers 0.2 - removed superfluous MACD dot plotted on the zero line for the current bar.

                To import:

                - Download the file contained in this thread to your desktop
                - From the Control Center window select the menu File > Utilities > Import NinjaScript
                - Select the downloaded file
                I did what it says here and then realized that I have to unzip the file, I believe. I unzipped the file and saved it to a folder. Went to NT import script and tried to select the file. I have a file called attachment, open it to a file called indicator. That is as far as I can go. Clicking on it does nothing. Did I do this wrong? If I was successful, how would it appear in the list of NT indicators?

                Comment


                  #53
                  Originally posted by Money Tree View Post
                  I did what it says here and then realized that I have to unzip the file, I believe. I unzipped the file and saved it to a folder. Went to NT import script and tried to select the file. I have a file called attachment, open it to a file called indicator. That is as far as I can go. Clicking on it does nothing. Did I do this wrong? If I was successful, how would it appear in the list of NT indicators?

                  Are you running that odd 6.5 beta version that uses ".ntns" file extensions?
                  If so you can juts rename as .ntns files are really just zip files. Shouldn't have to unzip...

                  Comment


                    #54
                    Originally posted by Gumphrie View Post
                    Are you running that odd 6.5 beta version that uses ".ntns" file extensions?
                    If so you can juts rename as .ntns files are really just zip files. Shouldn't have to unzip...
                    The problem was solved. But thanks for the prompt reply. I think it was there all along but I didn't see or know what name to look for. I thought it replaced the old MACD. It looks pretty neat and I have seen some good reports on it.

                    Mike

                    Comment


                      #55
                      File

                      New to NT, I like to try out the MACDbb indicator, can you provide a file with instructions?

                      Thanks

                      Comment


                        #56
                        Have you tried the first post?

                        Comment


                          #57
                          This is a great indicator! Has anyone tried to change this to a strategy? it would be interesting to see how it performs as a strategy that you can automate.

                          Thanks.

                          Comment


                            #58
                            Help

                            I was looking to download Macd BB Lines on my computer. I downloaded the zip files on my computer but am unable to unzip it. It says that I do not have the software programme that has created this indicator file. Can some one tell me what I need to do to be able to download this indicator. Thanks in advance.

                            Comment


                              #59
                              Originally posted by SteveM View Post
                              I was looking to download Macd BB Lines on my computer. I downloaded the zip files on my computer but am unable to unzip it. It says that I do not have the software programme that has created this indicator file. Can some one tell me what I need to do to be able to download this indicator. Thanks in advance.
                              Is that using the import procedure? :

                              - Download the file contained in this thread to your desktop
                              - From the Control Center window select the menu File > Utilities > Import NinjaScript
                              - Select the downloaded file

                              Which NT version you using?

                              Comment


                                #60
                                Hi, I have a meta trader platform, can somebody advise where can I get MACD BB lines indicator for meta trader. Thnaks

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by benmarkal, Yesterday, 12:52 PM
                                3 responses
                                22 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by helpwanted, Today, 03:06 AM
                                1 response
                                18 views
                                0 likes
                                Last Post sarafuenonly123  
                                Started by Brevo, Today, 01:45 AM
                                0 responses
                                11 views
                                0 likes
                                Last Post Brevo
                                by Brevo
                                 
                                Started by aussugardefender, Today, 01:07 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post aussugardefender  
                                Started by pvincent, 06-23-2022, 12:53 PM
                                14 responses
                                244 views
                                0 likes
                                Last Post Nyman
                                by Nyman
                                 
                                Working...
                                X