When I try to run the script, it doesnt do anything and the strategy automatically un-checks itself.
Can you spot what the issue is?
It's pulling the MACD, Stochastic, OrderFlow info from the 2 other unirenko charts.
else if (State == State.Configure)
{
AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)20, Value = 4, Value2 = 10 });
AddDataSeries(new BarsPeriod() { BarsPeriodType = (BarsPeriodType)20, Value = 6, Value2 = 10 });
}
else if (State == State.DataLoaded)
{
MACD1 = MACD(Closes[1], 12, 26, 9);
MACD2 = MACD(Closes[2], 12, 26, 9);
Stochastics1 = Stochastics(Closes[1], 7, 14, 3);
Stochastics2 = Stochastics(Closes[2], 7, 14, 3);
OrderFlowCumulativeDelta1 = OrderFlowCumulativeDelta(Closes[1], NinjaTrader.NinjaScript.Indicators.CumulativeDeltaType.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDeltaPeriod.Session, 0);
OrderFlowCumulativeDelta2 = OrderFlowCumulativeDelta(Closes[2], NinjaTrader.NinjaScript.Indicators.CumulativeDeltaType.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDeltaPeriod.Session, 0);
SMA1 = SMA(OrderFlowCumulativeDelta1.DeltaClose, 15);
SMA2 = SMA(OrderFlowCumulativeDelta2.DeltaClose, 15);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1
|| CurrentBars[1] < 1
|| CurrentBars[2] < 1)
return;
// Set 1
if ((Open[0] < Close[0])
&& (MACD1.Default[0] > MACD1.Default[1])
&& (MACD2.Default[0] > MACD2.Default[1])
&& (Stochastics1.K[0] <= 20)
&& (Stochastics2.K[0] <= 20)
&& (SMA1[0] > SMA2[1])
&& (SMA2[0] > SMA2[1]))
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
}
// Set 2
if (Open[0] > Close[0])
{
ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
}
Thanks!

Comment