| Overall Statistics |
|
Total Trades 410 Average Win 0.53% Average Loss -0.36% Compounding Annual Return 13.685% Drawdown 5.700% Expectancy 0.178 Net Profit 13.605% Sharpe Ratio 1.123 Loss Rate 52% Win Rate 48% Profit-Loss Ratio 1.45 Alpha 0.085 Beta 0.104 Annual Standard Deviation 0.083 Annual Variance 0.007 Information Ratio 0.152 Tracking Error 0.128 Treynor Ratio 0.894 Total Fees $820.00 |
namespace QuantConnect
{
public class BasicTemplateAlgorithm : QCAlgorithm
{
public override void Initialize()
{
//Start and End Date range for the backtest:
SetStartDate(2016, 1, 1);
SetEndDate(DateTime.Now.Date.AddDays(-1));
//Cash allocation
SetCash(100000);
//Add as many securities as you like. All the data will be passed into the event handler:
AddSecurity(SecurityType.Forex, "EURUSD", Resolution.Hour);
AddSecurity(SecurityType.Forex, "USDCHF", Resolution.Hour);
AddSecurity(SecurityType.Forex, "GBPJPY", Resolution.Hour);
AddSecurity(SecurityType.Forex, "AUDNZD", Resolution.Hour);
}
public void OnData(TradeBars data)
{
if (Time.DayOfWeek == DayOfWeek.Monday && !Portfolio["EURUSD"].Invested)
{
//Order function places trades: enter the string symbol and the quantity you want:
SetHoldings("EURUSD", .5);
SetHoldings("USDCHF", .5);
//Debug sends messages to the user console: "Time" is the algorithm time keeper object
Debug("Purchased EURUSD and USDCHF on " + Time.ToShortDateString());
}
if (Time.DayOfWeek == DayOfWeek.Tuesday && !Portfolio["GBPJPY"].Invested)
{
SetHoldings("GBPJPY", -.5);
SetHoldings("AUDNZD", -.5);
Debug("Sell GBPJPY and AUDNZD on " + Time.ToShortDateString());
}
if (Time.DayOfWeek == DayOfWeek.Friday)
{
Liquidate();
Debug("Liquidate " + Time.ToShortDateString());
}
}
}
}