| Overall Statistics |
|
Total Trades 67 Average Win 1.03% Average Loss -1.82% Compounding Annual Return 1.980% Drawdown 12.500% Expectancy 0.092 Net Profit 10.309% Sharpe Ratio 0.286 Probabilistic Sharpe Ratio 3.711% Loss Rate 30% Win Rate 70% Profit-Loss Ratio 0.57 Alpha 0.017 Beta 0.005 Annual Standard Deviation 0.062 Annual Variance 0.004 Information Ratio -0.765 Tracking Error 0.179 Treynor Ratio 3.88 Total Fees $0.00 Estimated Strategy Capacity $580000.00 Lowest Capacity Asset EURUSD 8G |
using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data.Market;
using QuantConnect.Data.UniverseSelection;
namespace QuantConnect.Algorithm.CSharp
{
public class ForexBootCamp : QCAlgorithm
{
string ticker = "EURUSD";
int period = 10;
Resolution resolution = Resolution.Daily;
RelativeStrengthIndex rsi;
Symbol symbol;
public override void Initialize()
{
SetStartDate(2016, 6, 13);
SetEndDate(2021, 6, 13);
SetCash(100000);
symbol = AddForex(ticker, resolution).Symbol;
rsi = RSI(symbol, period, MovingAverageType.Exponential, resolution);
SetWarmup(period);
}
public override void OnData(Slice data)
{
if (IsWarmingUp)
{
return;
}
if (Portfolio[symbol].Quantity <= 0 && rsi < 30)
{
SetHoldings(symbol, 1);
}
else if (Portfolio[symbol].Quantity >= 0 && rsi > 70)
{
SetHoldings(symbol, -1);
}
}
}
}