Display indicator behind the bars on the chart by default

This commit is contained in:
moshferatu 2024-03-12 14:17:12 -07:00
parent 03a414a933
commit b208228bab

View File

@ -45,7 +45,7 @@ namespace NinjaTrader.NinjaScript.Indicators
private List<string> Components = new List<string>();
private Dictionary<string, double> ComponentPrices = new Dictionary<string, double>();
private Dictionary<string, double> ComponentWeightings = new Dictionary<string, double>();
protected override void OnStateChange()
{
if (State == State.SetDefaults)
@ -66,7 +66,7 @@ namespace NinjaTrader.NinjaScript.Indicators
else if (State == State.Configure)
{
// For determining when RTH begins and ends.
AddDataSeries(Instrument.FullName,
AddDataSeries(Instrument.FullName,
new BarsPeriod { BarsPeriodType = BarsPeriodType.Day, Value = 1 }, "US Equities RTH");
RetrieveComponentData();
@ -84,6 +84,10 @@ namespace NinjaTrader.NinjaScript.Indicators
RegularTradingHoursClose = regularTradingHoursSession
.GetTradingDayEndLocal(regularTradingHoursSession.ActualTradingDayExchange).TimeOfDay;
}
else if (State == State.Historical)
{
SetZOrder(-1); // Display behind bars on chart.
}
}
protected override void OnBarUpdate()