You need to have at least 26 (same as your largest period used) bars for your MACD indicator first. Try this or something similar to make sure you have enough bars, it might work:
protected override void OnBarUpdate() { if (CurrentBar < 26) return; }
Leave a comment: