Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
-4.02%
Compounding Annual Return
-1.979%
Drawdown
4.00%
Expectancy
-1
Net Profit
-4.016%
Sharpe Ratio
-1.237
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.016
Beta
0
Annual Standard Deviation
0.013
Annual Variance
0
Information Ratio
-1.342
Tracking Error
0.102
Treynor Ratio
-93.76
Total Fees
$0.00
namespace QuantConnect 
{
    /*
    *   QuantConnect University: Overriding Transaction Models
    *
    *   Create your own fee models to better model your brokerage or market conditions. 
    *   With QuantConnect you can configure Slippage, Transaction Fees and Fill Models.
    */
    public class OverrideTransactionModelsAlgorithm : QCAlgorithm
    { 
        string _symbol = "EURUSD";
        bool _boughtToday = false;

        /// <summary>
        /// Initialize your algorithm configuration (cash, dates, securities)
        /// </summary>
        public override void Initialize() 
        {  
            //Set the start and end dates for backtest:
            SetStartDate(2013, 06, 01);
            SetEndDate(DateTime.Now.Date.AddDays(-1));
            
            //Set algorithm cash:
            SetCash(200000);
            
            //Add all the securities you'd like:
            AddSecurity(SecurityType.Forex, _symbol, Resolution.Minute);
            
            Securities[_symbol].TransactionModel = new FXCMTransactionModel();
        }
        
        /// <summary>
        /// TradeBars Data Event Handler - all IBM data passed into the data object: data["IBM"].Close
        /// </summary>
        public void OnData(TradeBars data) 
        {
            //Meaningless algorithm which buys on the 15th day of the month:
            // Using this we can test our $5,000 order fee :)
            if (Time.Day % 15 == 0 && _boughtToday == false) {
                Order(_symbol, 5);
                Debug("Sent order for " + _symbol + " on " + Time.ToShortDateString());
                _boughtToday = true;
            } else if (Time.Day % 15 != 0) {
                _boughtToday = false;
            }
        }
    }
}
namespace QuantConnect.Securities 
{
    
    public class FXCMTransactionModel : SecurityTransactionModel
    {
        public FXCMTransactionModel() 
        {  }

        public override decimal GetSlippageApproximation(Security security, Order order)
        {
            return 20m; //$ 20 units of currency slippage
        }

        /// <summary>
        /// Default implementation returns 0 for fees.
        /// </summary>
        /// <param name="security">The security matching the order</param>
        /// <param name="order">The order to compute fees for</param>
        /// <returns>The cost of the order in units of the account currency</returns>
        public override decimal GetOrderFee(Security security, Order order)
        {
            return 0m;
        }
    }

} // End QC Namespace