I manage to have this code,the indicator is working,it paints a line on de candle close.
I am stuck because I want to find a way to detect if the POC is above or below the candle close to use in strategy builder.
above is 1
below is -1
I have add a plot “POCclose” but I dont know what to do next
That will be wonderfull if someone can get and eye to tell me how to do that ,thanks
#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 USAbsorption3 : Indicator
{
private long POC;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @“Plots the difference between DeltaSinceHigh and DeltaSinceLow.”;
Name = “USAbsorption3”;
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;
UserDefinedVolume = 2000;
POC = 0;
AddPlot(new Stroke(Brushes.SaddleBrown, 5), PlotStyle.Line, "DD");
AddPlot(Brushes.Transparent, "POCclose");
}
else if (State == State.Configure)
{
AddVolumetric(Instrument.FullName, BarsPeriodType.Tick, UserDefinedVolume, VolumetricDeltaType.BidAsk, 1);
}
}
protected override void OnBarUpdate()
{
if (Bars == null)
return;
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType barsType = Bars.BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
if (barsType == null)
return;
try
{
double price;
POC = barsType.Volumes[CurrentBar].GetMaximumVolume(null, out price);
if (POC > UserDefinedVolume/3)
{
DD[0] = Close[0];
}
}
catch{}
}
#region Properties
[NinjaScriptProperty]
[Range(0, int.MaxValue)]
[Display(Name=“UserDefinedVolume”, Order=1, GroupName=“Parameters”)]
public int UserDefinedVolume
{ get; set; }
[Browsable(false)]
[XmlIgnore]
public Series DD
{
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 USAbsorption3 cacheUSAbsorption3;
public USAbsorption3 USAbsorption3(int userDefinedVolume)
{
return USAbsorption3(Input, userDefinedVolume);
}
public USAbsorption3 USAbsorption3(ISeries<double> input, int userDefinedVolume)
{
if (cacheUSAbsorption3 != null)
for (int idx = 0; idx < cacheUSAbsorption3.Length; idx++)
if (cacheUSAbsorption3[idx] != null && cacheUSAbsorption3[idx].UserDefinedVolume == userDefinedVolume && cacheUSAbsorption3[idx].EqualsInput(input))
return cacheUSAbsorption3[idx];
return CacheIndicator<USAbsorption3>(new USAbsorption3(){ UserDefinedVolume = userDefinedVolume }, input, ref cacheUSAbsorption3);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.USAbsorption3 USAbsorption3(int userDefinedVolume)
{
return indicator.USAbsorption3(Input, userDefinedVolume);
}
public Indicators.USAbsorption3 USAbsorption3(ISeries<double> input , int userDefinedVolume)
{
return indicator.USAbsorption3(input, userDefinedVolume);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.USAbsorption3 USAbsorption3(int userDefinedVolume)
{
return indicator.USAbsorption3(Input, userDefinedVolume);
}
public Indicators.USAbsorption3 USAbsorption3(ISeries<double> input , int userDefinedVolume)
{
return indicator.USAbsorption3(input, userDefinedVolume);
}
}
}
#endregion




