Overall Statistics
Total Trades
15
Average Win
0.06%
Average Loss
-0.14%
Compounding Annual Return
-0.036%
Drawdown
0.300%
Expectancy
0.021
Net Profit
-0.002%
Sharpe Ratio
-0.024
Loss Rate
29%
Win Rate
71%
Profit-Loss Ratio
0.43
Alpha
-0.004
Beta
-0.007
Annual Standard Deviation
0.009
Annual Variance
0
Information Ratio
3.754
Tracking Error
0.152
Treynor Ratio
0.027
Total Fees
$30.00
namespace QuantConnect 
{   
    public class FOREXBasicTemplateAlgorithm : QCAlgorithm
    {
    	Symbol symbol;
    	int quantity = 1000;
    	
        public override void Initialize()
        {
            SetStartDate(2016, 2, 1);         
            SetEndDate(2016, 2, 15); 
            SetCash(10000);
            symbol = AddForex("EURUSD", Resolution.Minute).Symbol;
        }

        public override void OnData(Slice slice) 
        {   
           if(!Portfolio.Invested)
           {
           		var filledPrice = slice[symbol].Price;
				MarketOrder(symbol, quantity, false, "Entry");     
				
				LimitOrder(symbol, -quantity, filledPrice + 0.01m, "Profit Target");
				StopMarketOrder(symbol, -quantity, filledPrice - 0.01m, "Stop Loss");
           }
        }
        
        public override void OnOrderEvent(OrderEvent orderEvent)
        {
        	Order actualOrder = Transactions.GetOrderById(orderEvent.OrderId);
            switch (orderEvent.Status)
            {
                case OrderStatus.Submitted:
	                Log(actualOrder.ToString());
                    break;
                case OrderStatus.Filled:
	                Log("\t => " +  orderEvent.ToString());
	                if (actualOrder.Type != OrderType.Market) { Liquidate(orderEvent.Symbol); } 
	                //Liquidate(orderEvent.Symbol);
                    break;
                case OrderStatus.Canceled:
	                Log("\t => " +  orderEvent.ToString() + "\n");
                    break;
                default:
                    break;
            }
        }
    }
}