Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VOLColor modifications

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

    VOLColor modifications

    Hi all,

    I want to take VOLColor indicator and modify it to do the following.



    Add neutral volume so either open close same bar are equal or off by one tick then the plot would be say black

    Calculate and plot the moving average of all up volume and down volume

    I have done web programing... so have some experience but can anyone help me get started on making these changes?

    regards,

    Blair
    Attached Files

    #2
    Blair,

    I suggest you start with the custom indicators tutorial so you get an idea of the different code blocks and what they do. http://www.ninjatrader-support.com/H...tml?Overview23

    Then you will need to create an additional plot for neutral volume. For doing a moving average, you will need to create plots for those too and create your MA logic to run off of whichever information you want.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      so far

      Here is my code so far

      I am not sure what the get { return Values[1]; } does

      protected override void Initialize()
      {
      Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Bar, "Volume Down"));
      Add(new Plot(new Pen(Color.Navy, 3), PlotStyle.Bar, "Volume Up"));
      Add(new Plot(new Pen(Color.Black, 3), PlotStyle.Bar, "Volume Neutral"));
      Add(new Line(Color.DarkGray, 0, "Zero line"));
      }

      protected override void OnBarUpdate()
      {
      if(Open[0]>Close[0])
      VOLDown.Set(Volume[0]);
      else if (Open[0]<Close[0])
      VOLUp.Set(Volume[0]);
      else if (Open[0]==Close[0])
      VOLNeutral.Set(Volume[0]);

      }

      #region Properties
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries VOLDown
      {
      get { return Values[0]; }
      }

      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries VOLUp
      {
      get { return Values[1]; }
      }

      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries VOLNeutral
      {
      get { return Values[1]; }
      }

      #endregion
      }

      Comment


        #4
        silly me

        I changed the

        get { return Values[1]; }

        to

        get { return Values[2]; }

        and now I am at stage one it works and plots neutral volume as a black bar

        Comment


          #5
          Each plot needs its own Values[] index. Values[0] is for the first plot. Values[1] is second. Values[2] is third. As you have made a new plot you need to use a new [] index for that plot.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            got it

            I answered my own question and thanks for your help

            now I need to add some moving average

            and the one that might be harder is to show vol bar black that is not == but off by one tick of ==

            Comment


              #7
              To do one tick off just do + 1 * TickSize.

              if (Close[0] == Open[0] + 1 * TickSize)

              If you want a range.

              if (Close[0] >= Open[0] || Close[0] <= Open[0] + 3 * TickSize)
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                indicator for post

                I have modified the volume indicator to show up down and now neutral volume

                Not sure if this is the proper way to make it available or not?
                Attached Files

                Comment


                  #9
                  Thanks for sharing, we would appreciate if you can repost this as a exported zip file. Thanks in advance!
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    ok done

                    Here is the properly exported file
                    Attached Files

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by dorotwart, Today, 11:43 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post dorotwart  
                    Started by letilleulskin, Today, 11:33 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post letilleulskin  
                    Started by letilleulskin, Today, 11:29 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post letilleulskin  
                    Started by MatthewLesko, Today, 11:13 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post MatthewLesko  
                    Started by Lance El Camino, Today, 04:14 PM
                    1 response
                    13 views
                    0 likes
                    Last Post s.kinra
                    by s.kinra
                     
                    Working...
                    X