Overall Statistics
Total Trades
3
Average Win
12.28%
Average Loss
-10.95%
Annual Return
130.304%
Drawdown
95.900%
Expectancy
0.414
Net Profit
11.067%
Sharpe Ratio
3.818
Loss Rate
33%
Win Rate
67%
Profit-Loss Ratio
1.12
Alpha
67.56
Beta
5.399
Annual Standard Deviation
17.707
Annual Variance
313.537
Information Ratio
3.819
Tracking Error
17.703
Treynor Ratio
12.524
using System;
using System.Collections;
using System.Collections.Generic; 
using QuantConnect.Securities;  
using QuantConnect.Models;

namespace QuantConnect {
    /*************************************************************************** 
        DATA EVENTS: TICK CLASS
        A Tick is an individual buy-sell trade, or bid-ask quote that enters the 
        financial market. With millions of people trading every day there can be 
        billions of ticks per day generated in the markets. If you are trading 
        within a 0-5 minute timeframe you can need all this data for making your investment decision.
    ***************************************************************************/    
    
    public class MyFirstAlgorithm : QCAlgorithm
    {
        public override void Initialize()
        {
            AddSecurity(SecurityType.Forex, "EURUSD", Resolution.Tick, true, 30, false);
            SetCash(10000);
            SetStartDate(2014, 4, 1);         
            SetEndDate(2014, 5, 1); 
        }
        
       //Tick Resolution Event Handler:
        Tick previousTick = new Tick();
        public void OnData(Ticks ticks)
        {
            foreach (var tick in ticks["EURUSD"])
	        {
	            try
	            {
    	            //if (previousTick == new Tick()) previousTick = tick;
                    if (tick.Price / previousTick.Price > 1.001m && Portfolio.HoldStock) 
                    {
                        Order("EURUSD", -Portfolio["EURUSD"].Quantity);
                    }
    
                    if (tick.Price/previousTick.Price < 0.9999m && Portfolio.Cash > 0)
                    {
                        var quantity = (int)(Portfolio.Cash / tick.Price);
                        Order("EURUSD", quantity);
                    }
	            }
	            catch(Exception err) 
                {
                    Error("OnData Err: " + err.Message);    
                }
            previousTick = tick;
	        }
        }
    }
}