Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Composite momentum

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

    #31
    Originally posted by michael fantoni View Post
    Thank u very much koganam!! Also the link u gave me is full of resources!!!
    It is a wonderful thing to have Google-Fu.

    Comment


      #32
      Indeed! It took me a while to realise the link with the kung-fu for ninjas

      Comment


        #33
        Dear koganam,

        its been long time since I asked u for help . I wanted to ask u the following: given an indicator which plots a combination of two other indicators, in my case is that mass flow rate in previous posts, vol/time, is it possible to make NT plot in the same bar the two different indicators? In other words, is it possible to "ask" NT to show me how much each indicator contributes to the single bar? Is it clear what Im saying? I tried to put something like

        double mfr = volume[0]/(time[0]);
        double vol = volume[0];

        Value.Set(mfr);
        volume.Set(vol);
        PlotColors[0][0] = upColor;
        PlotColors[1][0] = dnColor;

        where the first should plot the vol/time and the second only the volume, hoping that it would plot the relative percentages in the same bar but clearly it doesnt: if it did I wouldnt be here bothering u

        Thank u for ur time (even just for reading it)

        Regards

        Comment


          #34
          Originally posted by michael fantoni View Post
          Dear koganam,

          its been long time since I asked u for help . I wanted to ask u the following: given an indicator which plots a combination of two other indicators, in my case is that mass flow rate in previous posts, vol/time, is it possible to make NT plot in the same bar the two different indicators? In other words, is it possible to "ask" NT to show me how much each indicator contributes to the single bar? Is it clear what Im saying? I tried to put something like

          double mfr = volume[0]/(time[0]);
          double vol = volume[0];

          Value.Set(mfr);
          volume.Set(vol);
          PlotColors[0][0] = upColor;
          PlotColors[1][0] = dnColor;

          where the first should plot the vol/time and the second only the volume, hoping that it would plot the relative percentages in the same bar but clearly it doesnt: if it did I wouldnt be here bothering u

          Thank u for ur time (even just for reading it)

          Regards
          You should be able to plot anything that you want. I am not sure that I understand the question. Provided time is a DataSeries, and that time[0] is never zero, that should plot fine.

          Which plot are you missing?
          What errors are noted in the log?

          Comment


            #35
            Hello koganam,

            thank u for replying!!
            There r not errors whatsoever in the log: no outside range, nothing! Its not plotting the volume, I only get the vol/time, in green, the upColor: I checked the values of the bars against it the other indicator I had in the Data Box
            I post the script so u can see it:
            {
            [Description(" blabla")]
            public class MassFlowRate2 : Indicator
            {
            #region Variables

            private DataSeries volume;
            private DataSeries mfr;
            private Color upColor = Color.Green;
            private Color dnColor = Color.Red;

            #endregion

            protected override void Initialize()
            {
            Add(new Plot(new Pen(Color.Red, 9), PlotStyle.Bar, "mfr"));
            Add(new Plot(new Pen(Color.Blue, 9), PlotStyle.Line, "volume"));


            mfr = new DataSeries(this);
            volume = new DataSeries(this);
            }
            protected override void OnBarUpdate()
            {
            if (CurrentBar==0)
            {

            mfr.Set(0);
            volume.Set(0);
            Value.Set(0);


            }

            else
            {

            mfr.Set((Time[0]-Time[1]).TotalMinutes);
            volume.Set(Volume[0]);

            double mfr2 = Volume[0]/(mfr[0]);
            double vol = Volume[0];

            Value.Set(mfr2);
            volume.Set(vol);
            PlotColors[0][0] = upColor;
            PlotColors[1][0] = dnColor;






            }}

            }}

            Comment


              #36
              Originally posted by michael fantoni View Post
              Hello koganam,

              thank u for replying!!
              There r not errors whatsoever in the log: no outside range, nothing! Its not plotting the volume, I only get the vol/time, in green, the upColor: I checked the values of the bars against it the other indicator I had in the Data Box
              I post the script so u can see it:
              {
              [Description(" blabla")]
              public class MassFlowRate2 : Indicator
              {
              #region Variables

              private DataSeries volume;
              private DataSeries mfr;
              private Color upColor = Color.Green;
              private Color dnColor = Color.Red;

              #endregion

              protected override void Initialize()
              {
              Add(new Plot(new Pen(Color.Red, 9), PlotStyle.Bar, "mfr"));
              Add(new Plot(new Pen(Color.Blue, 9), PlotStyle.Line, "volume"));


              mfr = new DataSeries(this);
              volume = new DataSeries(this);
              }
              protected override void OnBarUpdate()
              {
              if (CurrentBar==0)
              {

              mfr.Set(0);
              volume.Set(0);
              Value.Set(0);


              }

              else
              {

              mfr.Set((Time[0]-Time[1]).TotalMinutes);
              volume.Set(Volume[0]);

              double mfr2 = Volume[0]/(mfr[0]);
              double vol = Volume[0];

              Value.Set(mfr2);
              volume.Set(vol);
              PlotColors[0][0] = upColor;
              PlotColors[1][0] = dnColor;






              }}

              }}
              Offhand, it looks like you may have some "circular definitions" and/or "name clashes". You have two Plots that are named exactly the same as 2 private DataSeries. You may be seeing an assignment clash. Without seeing how the plots properties are defined, it is hard to definitely say that that is the case

              Comment


                #37
                Where could I access these plot properties u mentioned in order to check them?

                Comment


                  #38
                  Also, I did name the plots the same as the series cos originally I thought that was the problem: I only get one plot if I name the plots differently!

                  Comment


                    #39
                    Originally posted by michael fantoni View Post
                    Where could I access these plot properties u mentioned in order to check them?
                    They are in the region marked: "Properties".

                    Comment


                      #40
                      Yep, I saw that a bit later

                      But I dont understand. I looked at the default MACD bundled with NT and it plots all of them. If u had 2 dataseries named alpha and beta, how would u go about plotting? wouldnt u write what I did?

                      Also, it would be nice if I could choose not to get log off the forum while Im banging on the script

                      Comment


                        #41
                        OHHHHHHHHHHHHHH!!! Finally! It works! I can plot them both and see how big one wrt the other! I attach it just in case u want to have a look at it. It doesnt say much but I needed to compare things on the same bar.

                        Thank u for all the support koganam!

                        Take care
                        Attached Files

                        Comment


                          #42
                          Originally posted by michael fantoni View Post
                          OHHHHHHHHHHHHHH!!! Finally! It works! I can plot them both and see how big one wrt the other! I attach it just in case u want to have a look at it. It doesnt say much but I needed to compare things on the same bar.

                          Thank u for all the support koganam!

                          Take care
                          Well, as you can see, once you cleared up your Plot naming issues, everything was tickety-boo.

                          Glad that I could help.

                          Comment


                            #43
                            Hello there!

                            hope all gd!
                            I would have a quick question and I havent found the topic in the forum. How could I tell NT to take the factorial of a quantity when building an indicator, the usual n! found in maths?

                            Regards

                            Comment


                              #44
                              Originally posted by michael fantoni View Post
                              Hello there!

                              hope all gd!
                              I would have a quick question and I havent found the topic in the forum. How could I tell NT to take the factorial of a quantity when building an indicator, the usual n! found in maths?

                              Regards
                              There is no C# Math() function for factorial. Are you asking for a coded function to call, or are you asking for a third-party library that might contain a factorial function?

                              Comment


                                #45
                                Hello koganam

                                I would like to take the factorial of lets say the WMA(Close,1)[0]. I know there is a limit to how big a number I can take the factorial of. But for prices around 1-10 units that should work. How could I go round it?
                                Thank u

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                579 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                334 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                101 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                554 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                551 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X