Overall Statistics
Total Trades
48
Average Win
1.48%
Average Loss
-1.66%
Compounding Annual Return
2.744%
Drawdown
16.100%
Expectancy
0.209
Net Profit
14.515%
Sharpe Ratio
0.378
Probabilistic Sharpe Ratio
5.925%
Loss Rate
36%
Win Rate
64%
Profit-Loss Ratio
0.89
Alpha
0.024
Beta
0.003
Annual Standard Deviation
0.064
Annual Variance
0.004
Information Ratio
-0.702
Tracking Error
0.18
Treynor Ratio
8.136
Total Fees
$0.00
Estimated Strategy Capacity
$570000.00
Lowest Capacity Asset
EURUSD 8G
using System;

namespace QuantConnect.Algorithm.CSharp
{
    public class BootCampTask : QCAlgorithm
    {
    	string ticker = "EURUSD";
    	decimal ratio = 0.99m;
    	int period = 20;
    	Resolution resolution = Resolution.Daily;
    	ExponentialMovingAverage ema;
    	Symbol symbol;
    	
        public override void Initialize()
        {
            SetStartDate(2016, 6, 09);
            SetEndDate(2021, 6, 09);
            SetCash(100000);

			symbol = AddForex(ticker, resolution).Symbol;
			ema = EMA(symbol, period, resolution);
			
			SetWarmup(period);
        }

        public override void OnData(Slice data)
        {
        	if (IsWarmingUp) return;
        	
			decimal buyPrice = Math.Round(ema * ratio, 2);
			decimal sellPrice = Math.Round(ema / ratio, 2);
			
        	Transactions.CancelOpenOrders();
        	if (Portfolio[symbol].Quantity <= 0)
        	{
        		decimal quantity = Portfolio.TotalPortfolioValue / buyPrice - Portfolio[symbol].Quantity;
        		quantity = Math.Floor(quantity);
        		LimitOrder(symbol, quantity, buyPrice);
        	}
        	else if (Portfolio[symbol].Quantity > 0)
        	{
        		decimal quantity = -Portfolio.TotalPortfolioValue / sellPrice - Portfolio[symbol].Quantity;
        		quantity = Math.Ceiling(quantity);
        		LimitOrder(symbol, quantity, sellPrice);
        	}
        }
    }
}