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

Volume High/Low.

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

    Volume High/Low.

    Hey Everyone,

    Has anyone developed an indicator much like MAX and MIN that applies to volume?

    #2
    Hi Drakmyre, I'm not aware of indicator like this, but you could directly pass the Volume into the MIN / MAX methods to create this.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hey Bertrand,

      Would I have to edit the code so it's based on Volume and not Price?

      Comment


        #4
        That sounds correct Drakmyre!
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hey Bertrand,

          How would I go about editing the code? It's a system indicator so I can't save it. I tried editing it but I don't know where to insert the volume input in the code after I copy and paste it to a new indicator.

          Comment


            #6
            Hi, which indicator are looking to edit? Just right click in the system one and save the code under a new name for modification...you can take a look at those volume based files from our sharing for coding ideas and workarounds - http://www.ninjatrader-support2.com/...=volume&desc=1
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hey Bertrand,

              Just the MAX and MIN. I want to be able to apply them to volume like I do with price.

              Comment


                #8
                Hello,

                You can do this, but it will take custom programming. Give it a try and if you get stuck ask us questions.
                DenNinjaTrader Customer Service

                Comment


                  #9
                  Hey Killer Bs,

                  Here's the code but I don't know where to change the inputs so it read volume instead of price.

                  //

                  #region Using declarations
                  using System;
                  using System.Diagnostics;
                  using System.Drawing;
                  using System.Drawing.Drawing2D;
                  using System.ComponentModel;
                  using System.Xml.Serialization;
                  using NinjaTrader.Data;
                  using NinjaTrader.Gui.Chart;
                  #endregion

                  // This namespace holds all indicators and is required. Do not change it.
                  namespace NinjaTrader.Indicator
                  {
                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  [Description("The Maximum shows the maximum of the last n bars.")]
                  public class MAX : Indicator
                  {
                  #region Variables
                  private int period = 14;
                  #endregion

                  /// <summary>
                  /// This method is used to configure the indicator and is called once before any bar data is loaded.
                  /// </summary>
                  protected override void Initialize()
                  {
                  Add(new Plot(Color.Green, "MAX"));

                  Overlay = true;
                  PriceTypeSupported = true;
                  }

                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                  double val = double.MinValue;
                  for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack >= 0; barsBack--)
                  val = Math.Max(val, Input[barsBack]);
                  Value.Set(val);
                  }

                  #region Properties
                  /// <summary>
                  /// </summary>
                  [Description("Numbers of bars used for calculations")]
                  [Category("Parameters")]
                  public int Period
                  {
                  get { return period; }
                  set { period = Math.Max(1, value); }
                  }
                  #endregion
                  }
                  }

                  #region NinjaScript generated code. Neither change nor remove.
                  // This namespace holds all indicators and is required. Do not change it.
                  namespace NinjaTrader.Indicator
                  {
                  public partial class Indicator : IndicatorBase
                  {
                  private MAX[] cacheMAX = null;
                  private static MAX checkMAX = new MAX();

                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  public MAX MAX(int period)
                  {
                  return MAX(Input, period);
                  }

                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  public MAX MAX(Data.IDataSeries input, int period)
                  {
                  checkMAX.Period = period;
                  period = checkMAX.Period;

                  if (cacheMAX != null)
                  for (int idx = 0; idx < cacheMAX.Length; idx++)
                  if (cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
                  return cacheMAX[idx];

                  MAX indicator = new MAX();
                  indicator.BarsRequired = BarsRequired;
                  indicator.CalculateOnBarClose = CalculateOnBarClose;
                  indicator.Input = input;
                  indicator.Period = period;
                  indicator.SetUp();

                  MAX[] tmp = new MAX[cacheMAX == null ? 1 : cacheMAX.Length + 1];
                  if (cacheMAX != null)
                  cacheMAX.CopyTo(tmp, 0);
                  tmp[tmp.Length - 1] = indicator;
                  cacheMAX = tmp;
                  Indicators.Add(indicator);

                  return indicator;
                  }
                  }
                  }

                  // This namespace holds all market analyzer column definitions and is required. Do not change it.
                  namespace NinjaTrader.MarketAnalyzer
                  {
                  public partial class Column : ColumnBase
                  {
                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  [Gui.Design.WizardCondition("Indicator")]
                  public Indicator.MAX MAX(int period)
                  {
                  return _indicator.MAX(Input, period);
                  }

                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  public Indicator.MAX MAX(Data.IDataSeries input, int period)
                  {
                  return _indicator.MAX(input, period);
                  }
                  }
                  }

                  // This namespace holds all strategies and is required. Do not change it.
                  namespace NinjaTrader.Strategy
                  {
                  public partial class Strategy : StrategyBase
                  {
                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  [Gui.Design.WizardCondition("Indicator")]
                  public Indicator.MAX MAX(int period)
                  {
                  return _indicator.MAX(Input, period);
                  }

                  /// <summary>
                  /// The Maximum shows the maximum of the last n bars.
                  /// </summary>
                  /// <returns></returns>
                  public Indicator.MAX MAX(Data.IDataSeries input, int period)
                  {
                  if (InInitialize && input == null)
                  throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

                  return _indicator.MAX(input, period);
                  }
                  }
                  }
                  #endregion

                  Do I tie the inputs to volume? How would I go about doing that?

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Pattontje, Yesterday, 02:10 PM
                  2 responses
                  15 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  229 views
                  0 likes
                  Last Post TradingLoss  
                  Started by agclub, 04-21-2024, 08:57 PM
                  3 responses
                  17 views
                  0 likes
                  Last Post TradingLoss  
                  Started by TradingLoss, 04-21-2024, 04:32 PM
                  4 responses
                  45 views
                  2 likes
                  Last Post TradingLoss  
                  Started by cre8able, 04-17-2024, 04:16 PM
                  6 responses
                  57 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X