Here's a code, basic calculation is ok, I tested on the chart:
#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
{
/// <summary>
/// Calculates the percentage of close relative to bar range.
/// Indicator is measured on a scale of 0 100.
/// Red candles closing near lows will have lower values.
/// Green candles closing near highs will have higher values.
/// </summary>
public class ClosePct : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Calculates the percentage of close relative to bar range.";
Name = "ClosePct";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = false;
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(new Stroke(Brushes.Teal, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.RangeValue);
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
Value[0] = (1-((High[0] - Close[0])/(High[0] - Low[0] + 0.0001))) * 100;
}
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private ClosePct[] cacheClosePct;
public ClosePct ClosePct()
{
return ClosePct(Input);
}
public ClosePct ClosePct(ISeries<double> input)
{
if (cacheClosePct != null)
for (int idx = 0; idx < cacheClosePct.Length; idx++)
if (cacheClosePct[idx] != null && cacheClosePct[idx].EqualsInput(input))
return cacheClosePct[idx];
return CacheIndicator<ClosePct>(new ClosePct(), input, ref cacheClosePct);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.ClosePct ClosePct()
{
return indicator.ClosePct(Input);
}
public Indicators.ClosePct ClosePct(ISeries<double> input )
{
return indicator.ClosePct(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.ClosePct ClosePct()
{
return indicator.ClosePct(Input);
}
public Indicators.ClosePct ClosePct(ISeries<double> input )
{
return indicator.ClosePct(input);
}
}
}
#endregion
1) How can I call it in the strategy? I tried using Prints, calling: "ClosePct[0]", but it returns an error of "Cannot apply indexing with [] to an expression of type 'method group'
2) I also want to add "Average over selected period" of ClosePct. (Like average ClosePct of recent 14 bars)
2.1) Should this be added to an indicator or to a strategy?
2.2) Can somebody help me with the code of it?

Comment