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

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 Barry Milan, Today, 10:35 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by WeyldFalcon, 12-10-2020, 06:48 PM
                    14 responses
                    1,428 views
                    0 likes
                    Last Post Handclap0241  
                    Started by DJ888, Yesterday, 06:09 PM
                    2 responses
                    9 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    40 views
                    0 likes
                    Last Post jeronymite  
                    Started by bill2023, Today, 08:51 AM
                    2 responses
                    16 views
                    0 likes
                    Last Post bill2023  
                    Working...
                    X