| Overall Statistics |
|
Total Trades 10001 Average Win 0.08% Average Loss -0.08% Compounding Annual Return -17.764% Drawdown 21.100% Expectancy -0.038 Net Profit -14.712% Sharpe Ratio -1.324 Loss Rate 52% Win Rate 48% Profit-Loss Ratio 1.00 Alpha -0.226 Beta 4.68 Annual Standard Deviation 0.114 Annual Variance 0.013 Information Ratio -1.466 Tracking Error 0.114 Treynor Ratio -0.032 Total Fees $0.00 |
namespace QuantConnect
{
public class BasicTemplateAlgorithm : QCAlgorithm
{
public string symbol = "EURUSD";
RollingWindow<QuoteBar> Pair;
public override void Initialize()
{
SetStartDate(2016, 1, 1);
SetEndDate(DateTime.Now);
SetCash(1000);
AddSecurity(SecurityType.Forex, symbol, Resolution.Hour);
Pair = new RollingWindow<QuoteBar>(5);
}
public void OnData(QuoteBars data)
{
Pair.Add(data[symbol]);
if (!Pair.IsReady) return;
if (Portfolio[symbol].Invested)
{
SetHoldings(symbol, 0);
}
if (!Portfolio[symbol].IsLong && Pair[0].Close < Pair[1].Open)
{
SetHoldings(symbol, 2, false, "Long " + symbol);
}
if (!Portfolio[symbol].IsShort && Pair[0].Close > Pair[1].Open)
{
SetHoldings(symbol, -2, false, "Short " + symbol);
}
}
}
}