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

% Change in Average Volume

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

    #16
    It's really up to you. First identify what you're looking for and then start breaking it down into objective rules the computer can follow. Start simple and add complexity once you've verified it works as you expect.

    One way to filter is to set a plot value as 1 when the conditions are true and 0 otherwise. You can then check against a value of 1 for this indicator in the market analyzer. This allows you to use bool conditions for your filter, rather than trying to identify a reasonable value to scan for.
    Ryan M.NinjaTrader Customer Service

    Comment


      #17
      hmmm, would something like this work?
      ----------------------------------------------------------------

      protected override void OnBarUpdate()
      {

      if (ToTime(Time[0]) <= ToTime(9, 45, 00) && Volume[0] > 288000)
      if (ToTime(Time[0]) <= ToTime(10, 00, 00) && Volume[0] > 576000)

      {
      Plot0.Set(1);
      }
       
      else
      {
      Plot0.Set(0);
      }

      Comment


        #18
        Yes, that's the right idea for setting plot values but your conditions will need some work.

        if (ToTime(Time[0]) <= ToTime(9, 45, 00) && Volume[0] > 288000)
        if (ToTime(Time[0]) <= ToTime(10, 00, 00) && Volume[0] > 576000)

        That says if the first line evaluates true, start evaluating the second line. You will then not receive any true conditions after 9:45, since the first condition excludes everything beyond this time frame.

        One approach around this is coding sequences with bool flags, but this will get messy if you're doing it for every 15 minute block.

        I see what you're trying to solve but unfortunately I'm not aware of a simple solution. If you're looking to have this professionally done, a NinjaScript consultant should be able to assist.
        Ryan M.NinjaTrader Customer Service

        Comment


          #19
          Okay, Thanks Ryan

          I have contacted a few NT coders to see what they say, I need another indicator I know I can't do just caught up in the challenge of this one

          I will try to make this my last question on the subject....

          Is it possible to create a starting point for a moving average? If I could get an SMA to start fresh each new day/session I think I can do it....

          Thanks,
          R.T.

          Comment


            #20
            R.S., I think you can work with something like this below for a 'session' SMA -

            Plot0.Set(SMA(Close, Bars.BarsSinceSession + 1)[0]);
            BertrandNinjaTrader Customer Service

            Comment


              #21
              Hi Bertrand,

              Thanks! This seems to work... do I have to define a period for the SMA or is this automatically creating the SMA for the session? In other words as new bars are added during the session is the SMA automatically going from a first bar of session one period SMA to a 2nd bar 2 period SMA and so forth?

              Thanks again!

              Comment


                #22
                That would be the Period, it's increasing then with each bar in the session until reset at the break. Comes close to the VWAP levels then I believe, but not taking volume into this one of course.
                BertrandNinjaTrader Customer Service

                Comment


                  #23
                  okay, well I changed the code to

                  Plot0.Set(SMA(Volume, Bars.BarsSinceSession + 1)[0]);

                  so that is giving me the session ema on volume right?

                  Comment


                    #24
                    Right - just have to swap SMA for EMA then.

                    Plot0.Set(EMA(Volume, Bars.BarsSinceSession + 1)[0]);
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #25
                      Awesome! I think this is going to work then for an on pace volume, at least it does in my head and looking at the charts it seems to...

                      so is the session it is calculating off of what I have set in my data series for the chart? I might be able to nail the last indicator I need from this code as well.

                      Thanks for all the help guys! I really appreciate it, hope you guys have a great New Year!

                      R.T.

                      Comment


                        #26
                        Glad to hear it's starting to come together for you.

                        If it's market analyzer, the session is controlled by the session template selection in the Right Click > Properties screen.

                        If it's a chart, yes, it's the Right Click > Data Series screen.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #27
                          Man, I feel I am close to the final indicator I need...

                          I got the summing of volume for the session, I just need the SMA to follow in session or add to itself the way the on pace does.

                          Here is what I have so far

                          Plot0.Set(((SUM(Volume, Bars.BarsSinceSession + 1)[0] - SMA(Volume, 390)[0]) / SMA(Volume, 390)[0]) * 100);

                          any idea on how I can get the SMA(Volume, 390)[0]) figure to add to itelf during the session?

                          Comment


                            #28
                            tshirtdeal,

                            I am not sure what you mean by "in session". Can you please clarify? Thanks.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #29
                              Hi Josh, Thanks for the reply...

                              What I mean by "in session" is this snippet...

                              (SMA(Volume, Bars.BarsSinceSession + 1)[0]);

                              I need to take the 30 day volume SMA and divide by 13 and then have that number be added to each new 30 minute bar of the session...

                              Comment


                                #30
                                So you want the SMA of the current session only? There is no way to just limit an indicator to only one session like that. If you want that calculation you will need to roll in your own SMA logic instead of calling the SMA() indicator and only run it on the bars of the current session.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by dcriador, Today, 09:33 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post dcriador  
                                Started by dcriador, Yesterday, 10:45 AM
                                4 responses
                                29 views
                                0 likes
                                Last Post dcriador  
                                Started by reynoldsn, Today, 09:01 AM
                                2 responses
                                7 views
                                0 likes
                                Last Post reynoldsn  
                                Started by dcriador, Yesterday, 08:56 AM
                                2 responses
                                23 views
                                0 likes
                                Last Post dcriador  
                                Started by Haiasi, Today, 09:16 AM
                                1 response
                                4 views
                                0 likes
                                Last Post NinjaTrader_Erick  
                                Working...
                                X