Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
23.534%
Drawdown
0.100%
Expectancy
0
Net Profit
0%
Sharpe Ratio
10.16
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.103
Beta
-0.015
Annual Standard Deviation
0.012
Annual Variance
0
Information Ratio
7.884
Tracking Error
0.174
Treynor Ratio
-7.983
Total Fees
$2.00
namespace QuantConnect 
{   
    public class FOREXBasicTemplateAlgorithm : QCAlgorithm
    {
    	Symbol eurusd;
    	bool first = true;
        public override void Initialize()
        {
            SetStartDate(2016, 2, 1);         
            SetEndDate(2016, 2, 5); 
            SetCash(10000);
            eurusd = AddForex("EURUSD", Resolution.Hour, market: "Oanda", leverage:1).Symbol;
            
            SetBrokerageModel(BrokerageName.OandaBrokerage);
        }

        public override void OnData(Slice slice) 
        {   
            if (first) 
            {
                MarketOrder(eurusd, 1000);
                Debug("Purchased EURUSD on " + Time.ToShortDateString());
                StopMarketOrder(eurusd, -1000, slice[eurusd].Price * 0.9m);
                first = false;
            }
        }
        
        public override void OnOrderEvent(OrderEvent orderEvent)
        {
        	switch (orderEvent.Status)
        	{
                case OrderStatus.Submitted:
                    Log(orderEvent.ToString());
                    Log("Margin Remaining : $ " + Portfolio.MarginRemaining.ToString("n"));
                    break;
                case OrderStatus.Filled:
                    Log(orderEvent.ToString());
                    Log("Margin Remaining : $ " + Portfolio.MarginRemaining.ToString("n"));
                    break;
                default:
                    break;
        	}
        }
    }
}