Any help is appreciated! Thanks!
Here's my code:
protected override void Initialize() { CalculateOnBarClose = true; Add(PeriodType.Day, 1); Add(SMA(Closes[1],mA)); Add(SMA(Closes[0],mA)); SMA(Closes[1],mA).Plots[0].Pen.Color = Color.Blue; } protected override void OnBarUpdate() { if (BarsInProgress == 0) { // Only operate on the hourly chart if (Close[0] > SMA(BarsArray[1], mA)[0]) { // uptrend indicator if (Close[0] > SMA(mA)[0]) { // long entry signal EnterLong(); } else { ExitLong(); ExitShort(); } } else if (Close[0] < SMA(BarsArray[1],mA)[0]){ // downtrend indicator if (Close[0] < SMA(mA)[0]) { // short entry signal EnterShort(); } else { ExitLong(); ExitShort(); } } } }
Comment