With your help in the past, i did this indicator.
How can i define that it show the calculation on the main panel (price chart) instead
line on the indicator panel
like (example result) 0.25 on one of the corners
Thank you
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class Ofer : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
private double X = 0;
#region Initialize and Terminate
protected override void Initialize()
{
ChartOnly = true;
Overlay = true;
CalculateOnBarClose = false;
//AllowRemovalOfDrawObjects = true;
}
#endregion
protected override void OnBarUpdate()
{
X = (Close[0] - Low[0]) / (High[0] - Low[0]);
Value.Set(X);
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = 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 Ofer[] cacheOfer = null;
private static Ofer checkOfer = new Ofer();
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Ofer Ofer(int myInput0)
{
return Ofer(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Ofer Ofer(Data.IDataSeries input, int myInput0)
{
if (cacheOfer != null)
for (int idx = 0; idx < cacheOfer.Length; idx++)
if (cacheOfer[idx].MyInput0 == myInput0 && cacheOfer[idx].EqualsInput(input))
return cacheOfer[idx];
lock (checkOfer)
{
checkOfer.MyInput0 = myInput0;
myInput0 = checkOfer.MyInput0;
if (cacheOfer != null)
for (int idx = 0; idx < cacheOfer.Length; idx++)
if (cacheOfer[idx].MyInput0 == myInput0 && cacheOfer[idx].EqualsInput(input))
return cacheOfer[idx];
Ofer indicator = new Ofer();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.MyInput0 = myInput0;
Indicators.Add(indicator);
indicator.SetUp();
Ofer[] tmp = new Ofer[cacheOfer == null ? 1 : cacheOfer.Length + 1];
if (cacheOfer != null)
cacheOfer.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheOfer = tmp;
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>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.Ofer Ofer(int myInput0)
{
return _indicator.Ofer(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.Ofer Ofer(Data.IDataSeries input, int myInput0)
{
return _indicator.Ofer(input, myInput0);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.Ofer Ofer(int myInput0)
{
return _indicator.Ofer(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.Ofer Ofer(Data.IDataSeries input, int myInput0)
{
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.Ofer(input, myInput0);
}
}
}
#endregion
Comment