Overall Statistics
namespace QuantConnect 
{   
    /*
    *   QuantConnect University: Full Basic Template:
    *
    *   The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full algorithm can be found at:
    *   https://github.com/QuantConnect/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
    */
    public class FXTestAlgorithm : QCAlgorithm, IAlgorithm
    {
    	
    	string symbol = "EURUSD";
    	// SimpleMovingAverage smaShort;
    	// SimpleMovingAverage smaLong;
    	ExponentialMovingAverage smaShort;
    	ExponentialMovingAverage smaLong;
    	DateTime Today = DateTime.Now;
    	
    	decimal valueFX; 
    	
        public override void Initialize() 
        {
			
            //Start and End Date range for the backtest:
            SetStartDate(2015, 1, 1);         
            SetEndDate(2015, 3, 1);
            
            //Cash allocation
            SetCash(30000);
            
            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Forex, symbol, Resolution.Minute);
          //  SetRunMode(RunMode.Series);
            
            // smaShort = SMA(symbol, 10, Resolution.Minute);
            // smaLong = SMA(symbol, 50, Resolution.Minute);
            smaShort = EMA(symbol, 10, Resolution.Minute);
            smaLong = EMA(symbol, 50, Resolution.Minute);
            
            
        }

        public void OnData(TradeBars data) 
        {   
          
          if(!smaShort.IsReady || !smaLong.IsReady) return;
          
          if(Today.Date == data[symbol].Time.Date) return;
          
          Today = data[symbol].Time.Date;
          
          valueFX = data[symbol].Close;
          
          int holdings = Portfolio[symbol].Quantity;
          
          if(holdings == 0 || holdings < 0){
          	if(smaShort > smaLong){
          		MarketOrder("EURUSD", (Math.Abs(holdings) + 100));
                Debug("Purchased EURUSD on " + Time.ToShortDateString());
          	}
          } else if(holdings == 0 || holdings > 0){
          	if(smaLong > smaShort){
          		MarketOrder("EURUSD", -(100 + holdings));
                Debug("Sold EURUSD on " + Time.ToShortDateString());
          	}
          }
           
           
        }
    }
}