Overall Statistics
Total Trades
8917
Average Win
0.98%
Average Loss
-0.01%
Compounding Annual Return
-25.594%
Drawdown
25.700%
Expectancy
-0.683
Net Profit
-24.379%
Sharpe Ratio
-3.792
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
107.72
Alpha
-0.203
Beta
-0.039
Annual Standard Deviation
0.054
Annual Variance
0.003
Information Ratio
-1.367
Tracking Error
0.145
Treynor Ratio
5.261
Total Fees
$2628.32
namespace QuantConnect 
{   
    
    public class BasicTemplateAlgorithm : QCAlgorithm
    {
    	public string pair1 = "EURUSD";
    	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);
            
            //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);

        }

        
	    public void OnData(TradeBars data) {
	    	if(data[pair1].Close < 0.01M) return;
	    	SetHoldings(pair1, 1);
	    	
	    	if(data[pair1].Close > sm + dev)
	    		MarketOrder(pair1,5);
	    	else if (data[pair1].Close < -(sm + dev))
	    		SetHoldings(pair1, -5);
	    	else SetHoldings(pair1,0);

        }
        
	  
    }
}