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

Composite momentum

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

    #16
    Originally posted by michael fantoni View Post
    Ah, I see! sorry!

    yep, just checked it. The one that does plot, difference/volume, doesnt show any error whereas the volume/difference shows a "Value outside range", like u originally said: most likely is some range value not available. but why does it do for one and not for the other? If the value is outside some range should be for both calculations? So the fix I added is not working then.
    Check your log, and you should find that the plot blows up on a bar where the Close is the same as the Close of the previous bar, in which case dividing by difference would be a division by zero. You need to take care of the exception in the code.

    When I am being lazy, and do not really want to think of what is happening, I would just say that as the Close has not changed, neither should the plot, hence:

    Code:
                difference.Set((Close[0] - Close[1])*1000000);
                volume.Set(Volume[0]);
                double weak = Close[0] != Close[1] ? volume[0]/difference[0] : Value[1];
                Value.Set(weak);

    Comment


      #17
      Thank you very koganam!!!

      it works so smoothly now!!!

      Regards

      Comment


        #18
        Hello there,

        I built this indicator today. Basically, I want to use concepts from physics, in this case fluid dynamics, to compute the mass flow rate. In this case, since Im considering Renko bars, it is then equal to momentum, I give a brief explanation as to why this is so in the indicator. What I would like someone to do is if the indicator does actually what I meant for it to do: I would need to be sure about it to go on with my studies. I wrote it to take the volume in each given bar and divide it by the time it took to make that bar. I attach the indicator in .cs and a chart of 6E with the volume indicator to compare it.

        Thank you for your time.

        Regards
        Attached Files

        Comment


          #19
          Originally posted by michael fantoni View Post
          Hello there,

          I built this indicator today. Basically, I want to use concepts from physics, in this case fluid dynamics, to compute the mass flow rate. In this case, since Im considering Renko bars, it is then equal to momentum, I give a brief explanation as to why this is so in the indicator. What I would like someone to do is if the indicator does actually what I meant for it to do: I would need to be sure about it to go on with my studies. I wrote it to take the volume in each given bar and divide it by the time it took to make that bar. I attach the indicator in .cs and a chart of 6E with the volume indicator to compare it.

          Thank you for your time.

          Regards
          Conceptually, the equivalent to mass flow rate, for me, would be either (Price * Volume) / Time, or maybe (Range * Volume) / Time, not just Volume / Time.

          Comment


            #20
            So that u would suggest, physically, price would be considered as the equivalent of density: mass=densityXvolume?

            did u manage to have a look at it? if it does what it is supposed to do? to plot Volume/time?
            physically, momentum=massXvelocity. Since the range is fixed, the plot would be proportional to physical momentum, would u agree on this?

            Comment


              #21
              Originally posted by michael fantoni View Post
              So that u would suggest, physically, price would be considered as the equivalent of density: mass=densityXvolume?

              did u manage to have a look at it? if it does what it is supposed to do? to plot Volume/time?
              physically, momentum=massXvelocity. Since the range is fixed, the plot would be proportional to physical momentum, would u agree on this?
              I am not sure that I quite understand. The range is not fixed.

              Comment


                #22
                how do u mean? Renko bars have fixed range. If u take the range to be the length, thats fixed. since momentum= massXdistance/time, the distance is the range of the Renko bar. What changes is only the "mass" and the time in that bar,this is why I see it as massXconstant/time. Dont u agree on it?

                Comment


                  #23
                  Originally posted by michael fantoni View Post
                  how do u mean? Renko bars have fixed range. If u take the range to be the length, thats fixed. since momentum= massXdistance/time, the distance is the range of the Renko bar. What changes is only the "mass" and the time in that bar,this is why I see it as massXconstant/time. Dont u agree on it?
                  Sorry. I did not see the reference to Renko bars. I must have missed it somehow. Yes, for Renko bars or Range bars, you are quite right.

                  Comment


                    #24
                    Yep, I use the HA on Renko, its a bit better than just raw Renko bars. I was wondering if u could kindly confirm that this indicator is plotting the right thing, volume/time for each bar. Could u have a look at it? its a 10 lines code. u see, Im interested in models just per se, I guess pretty much everyone can make at least 1 renko bar profit a day with the standard indicators, like MACD for example, just need to wait for it, thats what I have been doing for months live with demo accounts: sit and wait. Im interested in applying physics to stock markets out of pure research.

                    Regards

                    Comment


                      #25
                      Originally posted by michael fantoni View Post
                      Yep, I use the HA on Renko, its a bit better than just raw Renko bars. I was wondering if u could kindly confirm that this indicator is plotting the right thing, volume/time for each bar. Could u have a look at it? its a 10 lines code. u see, Im interested in models just per se, I guess pretty much everyone can make at least 1 renko bar profit a day with the standard indicators, like MACD for example, just need to wait for it, thats what I have been doing for months live with demo accounts: sit and wait. Im interested in applying physics to stock markets out of pure research.

                      Regards
                      In what you wrote, your calculation of the time will certainly not be correct for what you intend it to be. For one thing, you added the number of the hour to the total seconds past the hour. That will be no kind of unit.

                      For another, maybe you are making complex that which is pretty simple. The time that has elapsed for the construction of a bar is simply (Time[0] - Time[1]), which is a TimeSpan variable that you can convert to any other kind of primitive structure variable.

                      Comment


                        #26
                        Dear koganam,

                        thank u very much for ur time. Unfortunately, if I simply put

                        time.Set(Time[0]-Time[1])

                        in the code, it will give me an error: it cannot convert from System.TimeSpan to double. So I wouldnt know how to go about it. Didnt find much help in the Help. Would u know a quick way round it?

                        Regards

                        Comment


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

                          thank u very much for ur time. Unfortunately, if I simply put

                          time.Set(Time[0]-Time[1])

                          in the code, it will give me an error: it cannot convert from System.TimeSpan to double. So I wouldnt know how to go about it. Didnt find much help in the Help. Would u know a quick way round it?

                          Regards
                          To what units are you trying to convert the time_elapsed?

                          Comment


                            #28
                            Hello koganam

                            considering that in less than 30sec there r moves of 3 Renko(15) bars, and that at other times the Renko just sits there, going up and down within hour(s), I was planning to measure it in minutes. But what I really didnt like of the previous set up I had is that moves taking longer than 15 minutes were treated all the same, regardless of how long it actually took to form that bar. Would u think duration in minutes for Renko(15) is a sensible unit of time? How would u tell NT to measure it in minutes. I tried the Time[0].hour or minute but it gives error again.
                            Thank u for your time

                            Regards

                            Comment


                              #29
                              Originally posted by michael fantoni View Post
                              Hello koganam

                              considering that in less than 30sec there r moves of 3 Renko(15) bars, and that at other times the Renko just sits there, going up and down within hour(s), I was planning to measure it in minutes. But what I really didnt like of the previous set up I had is that moves taking longer than 15 minutes were treated all the same, regardless of how long it actually took to form that bar. Would u think duration in minutes for Renko(15) is a sensible unit of time? How would u tell NT to measure it in minutes. I tried the Time[0].hour or minute but it gives error again.
                              Thank u for your time

                              Regards
                              A difference in time is a TimeSpan variable, so you just need to use the correct syntax:

                              (Time[0] - Time[1]).TotalMinutes

                              ref: http://msdn.microsoft.com/en-us/libr...espan.aspx#Y76

                              Comment


                                #30
                                Thank u very much koganam!! Also the link u gave me is full of resources!!!

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post Javierw.ok  
                                Started by timmbbo, Today, 08:59 AM
                                2 responses
                                10 views
                                0 likes
                                Last Post bltdavid  
                                Started by alifarahani, Today, 09:40 AM
                                6 responses
                                41 views
                                0 likes
                                Last Post alifarahani  
                                Started by Waxavi, Today, 02:10 AM
                                1 response
                                19 views
                                0 likes
                                Last Post NinjaTrader_LuisH  
                                Working...
                                X