Overall Statistics
Total Trades
1
Average Win
36.15%
Average Loss
0.00%
Annual Return
22.648%
Drawdown
6.700%
Expectancy
0.000
Net Profit
36.153%
Sharpe Ratio
1.863
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.008
Beta
0.902
Annual Standard Deviation
0.107
Annual Variance
0.011
Information Ratio
-0.287
Tracking Error
0.044
Treynor Ratio
0.22
using System;
using System.Collections;
using System.Collections.Generic;
using QuantConnect.Securities;
using QuantConnect.Models;

namespace QuantConnect {

    public class CustomDataFilter : ISecurityDataFilter
    {
        
        /// <summary>
        /// Filter out a tick from this vehicle, with this new data:
        /// </summary>
        /// <param name="data">New data packet:</param>
        /// <param name="vehicle">Vehicle of this filter.</param>
        public bool Filter(Security asset, BaseData data)
        {
            // TRUE -->  Accept Tick
            // FALSE --> Reject Tick

            //Example:
            if (data.Time.DayOfWeek != DayOfWeek.Wednesday)
            {
                return false;
            }
            
            return true;
        }
        
    }
}                        
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic; 
using QuantConnect.Securities;  
using QuantConnect.Models;    

namespace QuantConnect {  
    
    public partial class QCUDataFiltering : QCAlgorithm 
    {
        public override void Initialize()
        {
            SetStartDate(2013, 1, 1);          
            SetEndDate(DateTime.Now.Date.AddDays(-1)); 
            SetCash(25000);
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
            
            
            //Add our custom data filter.
            Securities["SPY"].DataFilter = new CustomDataFilter();
        }
        
        public void OnData( TradeBars data )
        {
            //Because of our data filter this first order should be on a wednesday. We should only get Wednesday's data!
            if (!Portfolio.Invested)
            {
                SetHoldings("SPY", 1);
            }
        }
    }
}