# EMA code does not work anymore

**URL:** <https://forums.collective2.com/t/ema-code-does-not-work-anymore/9100>\
**Category:** C2 Explorer\
**Created:** [December 28, 2016, 9:19am UTC](https://forums.collective2.com/t/ema-code-does-not-work-anymore/9100 "2016-12-28T09:19:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TrendNeutral](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/trendneutral/32/238_2.png) [@TrendNeutral](https://forums.collective2.com/u/TrendNeutral)\
**Post date:** [December 28, 2016, 9:19am UTC](https://forums.collective2.com/t/ema-code-does-not-work-anymore/9100/1 "2016-12-28T09:19:45Z")

</div>

@BobSvan2 the code below used to work. Now when I run it only the first 5 system equity curve appear…  
why?

// Your systems selection  
Int64[] systems = new Int64[] {  
102772812, 104651752 ,102125034, 100722273,98408819,81128026,98128454,92190352,100166454,104664854,104632446,100578638,98858556,100738045,100848973,84372841,85617966,95709284,92527663,89091740,100859365,100761669,101509154,68456563

};

// Your EMA period  
int emaPeriod = 150;

foreach (var systemId in systems)  
{  
// Get a system (for its Name)  
var c2System = GetC2SYSTEM(systemId);

```
        // Daily equity data with commissions and fees
        ITimeSheet timeSheet = TimeSheetFactory(systemId, TimeInterval.Day);

        // Let TimeSheet run
        timeSheet.EquitiesSheet();

        // Extract equity data. 
        var equity = timeSheet.GetColumn(systemId, EquityType.Equity);

        // Your Technical analysis data
        var taData = C2TALib.EMA(equity, emaPeriod);

        // Create a chart object
        ITimeSeriesChart chart = new TimeSeriesChart();
        chart.Name = c2System.Name;

        // Add equity to the chart
        chart.Add(equity, "Equity", Color.Blue);

        // Add Technical analysis to the chart
        chart.Add(taData, "EMA_" + emaPeriod.ToString(), Color.Red);
        
        // Show the chart
        CHART = chart;

```

}

---

<div class="post-metadata">

**Author:** ![BobSvan2](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/bobsvan2/32/21391_2.png) [@BobSvan2](https://forums.collective2.com/u/BobSvan2)\
**Post date:** [December 28, 2016, 2:00pm UTC](https://forums.collective2.com/t/ema-code-does-not-work-anymore/9100/2 "2016-12-28T14:00:03Z")

</div>

It works actually.  
But the bottom graphs are not shown because of some changes in the page design (C2 page height).  
I will ask to correct that.  
Meantime - resize your browser’s window a little (after calculations). The bottom graphs are shown there then.

---

<div class="post-metadata">

**Author:** ![TrendNeutral](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/trendneutral/32/238_2.png) [@TrendNeutral](https://forums.collective2.com/u/TrendNeutral)\
**Post date:** [January 29, 2017, 6:32am UTC](https://forums.collective2.com/t/ema-code-does-not-work-anymore/9100/3 "2017-01-29T06:32:38Z")

</div>

@BobSvan2 thanks it’s been solved now. I was wondering: is it possible to get that code to send a daily email with the generated charts? That would be awesome 😄
