#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class myPVPperBar : Indicator
{
private double MaxVolume = 0;
private double MaxPrice = 0;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Peak Volume Price - Plots the price at which highest number of contracts or shares were traded at any given time. It is also the maximum point on a volume profile. The PVP resets at the start of every new session.";
Name = "myPVPperBar";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(Brushes.Goldenrod, "PVPLine");
}
}
protected override void OnBarUpdate()
{
if (IsFirstTickOfBar)
{
MaxVolume = 0;
MaxPrice = 0.0;
}
if (Volume[0] > MaxVolume)
{
MaxVolume = Volume[0];
MaxPrice = Close[0];
}
PVPLine[0] = MaxPrice;
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> PVPLine
{
get { return Values[0]; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private myPVPperBar[] cachemyPVPperBar;
public myPVPperBar myPVPperBar()
{
return myPVPperBar(Input);
}
public myPVPperBar myPVPperBar(ISeries<double> input)
{
if (cachemyPVPperBar != null)
for (int idx = 0; idx < cachemyPVPperBar.Length; idx++)
if (cachemyPVPperBar[idx] != null && cachemyPVPperBar[idx].EqualsInput(input))
return cachemyPVPperBar[idx];
return CacheIndicator<myPVPperBar>(new myPVPperBar(), input, ref cachemyPVPperBar);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.myPVPperBar myPVPperBar()
{
return indicator.myPVPperBar(Input);
}
public Indicators.myPVPperBar myPVPperBar(ISeries<double> input )
{
return indicator.myPVPperBar(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.myPVPperBar myPVPperBar()
{
return indicator.myPVPperBar(Input);
}
public Indicators.myPVPperBar myPVPperBar(ISeries<double> input )
{
return indicator.myPVPperBar(input);
}
}
}
#endregion