Has anyone developed an indicator much like MAX and MIN that applies to volume?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Volume High/Low.
Collapse
X
-
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
Comment
-
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 cmoran13, 04-16-2026, 01:02 PM
|
0 responses
42 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
25 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|
||
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
162 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
98 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
157 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|

Comment