this codes only plot two arrows. the logic look okay. but I want it to be able to plot on the chart across all trading hours. Why it only plots two arrows ?
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if (MACD1.Diff[0] > 0)
{
Draw.Text(this, @"plotMACDBuySell Text_1", @"macd diff > 0", 0, (Close[0] + 30) );
MacdAboveZero = true;
}
// Set 2
if (MACD1.Diff[0] < 0)
{
Draw.Text(this, @"plotMACDBuySell Text_1", @"macd diff < 0", 0, (Close[0] + 30) );
MacdBelowZero = true;
}
// Set 3
if ((MacdBelowZero == true)
&& (CrossAbove(MACD2.Default, MACD2.Avg, 1)))
{
Draw.ArrowUp(this, @"plotMACDBuySell Arrow up_1", true, 0, (Low[0] + (-12 * TickSize)) , Brushes.Lime);
MacdBuy = true;
}
// Set 4
if ((CrossBelow(MACD2.Default, MACD2.Avg, 1))
&& (MacdAboveZero == true))
{
Draw.ArrowDown(this, @"plotMACDBuySell Arrow down_1", true, 0, High[0], Brushes.Red);
MacdSell = true;
}
}

Comment