Overall Statistics
namespace QuantConnect 
{   
    
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
    	public string pair1 = "EURUSD";
    	RollingWindow<double> window;
    	RollingWindow<double> diffWindow;
    	const int WL = 200;

		SimpleMovingAverage sm;
		StandardDeviation dev;
    	
        public override void Initialize() 
        {
        	SetStartDate(2015,01,01);
            SetEndDate(2015, 12, 12);         
            
            SetBrokerageModel(BrokerageName.FxcmBrokerage);
            //SetBrokerageModel(BrokerageName.OandaBrokerage);
            
            SetCash(10000);
            
            //Broken
            //AddForex(pair1, Resolution.Hour, Market.Oanda);
            //Uncomment for working FXCM data
            AddForex(pair1, Resolution.Hour, Market.FXCM, leverage:10.0M);
            Securities[pair1].SetLeverage(10.0M);
 
            sm = SMA(pair1,WL);
            dev = STD(pair1,WL);
            
            window = new RollingWindow<double>(WL);
            diffWindow = new RollingWindow<double>(WL);
           
        }

        
	    public void OnData(TradeBars data) {
	    	if(data[pair1].Close < 0.01M) return;
	    	SetHoldings(pair1, 1);
	    	
	    	if(data[pair1].Close > sm + dev)
	    		SetHoldings(pair1, 1);
	    	else if (data[pair1].Close < -(sm + dev))
	    		SetHoldings(pair1, -1);
	    	else SetHoldings(pair1,0);
	    	
	    	Log("dev: " + dev);
	    	Log("mean: " + sm);
			Log("current: " + data[pair1].Close);
			Console.WriteLine("current2: " + data[pair1].Close);
	    	
        }
        
	  
    }
}