Thanks Jared.

I implemented the computation of minimum volume (both in dollars and in shares) for n days as follows:

**Volume_Dollar = x.DollarVolume**

Volume_Share = x.Volume

self.min_dollar_volume = IndicatorExtensions.MIN(Volume_Dollar, self.value_MinVolumeDays)

self.min_volume = IndicatorExtensions.MIN(Volume_Share, self.value_MinVolumeDays)

However, I had the following errors:

**Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the MIN method. Please checkout the API documentation.**

at CoarseSelectionFunction in main.py:line 94

TypeError : No method matches given arguments for MIN (Open Stacktrace)

Is there another method of computing the minimum volume (both in dollars and in shares) for n days?

Thanks a lot.

PS: here's a part of my python program:

**def Initialize(self):**

'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

** #Risk Management Parameters**

TradingEquity = self.GetParameter("Starting Trading Equity") #Starting equity used for Trading

FixedFractionalRisk = self.GetParameter("Fixed Fractional Risk") #Fraction of the equity risked in trading

#Screening Parameters

MinVolumeDays = self.GetParameter("Days for Minimum Volume") #Number of days needed to compute the minimum number of volume (in shares and in dollar value) (default = 50 days)

MinStockPrice = self.GetParameter("Minimum Stock Price") #Minimum price of stock

MaxPosition = self.GetParameter("Maximum Number of Positions") #Number of positions allowed

** #Entry Parameters**

MADays = self.GetParameter("Moving Average Period") #Number of days needed to compute the simple moving average of stock price

ADXDays = self.GetParameter("ADX Period") #Number of days needed to compute the ADX

ADXThreshold = self.GetParameter("ADX Threshold") #Threshold used to determine if ADX produces buy signal. If ADX reaches above threshold, then the indicator produces a buy signal. (default = 45)

ATRDays = self.GetParameter("ATR Period") #Number of days needed to compute the ATR

RSIDays = self.GetParameter("RSI Period") #Number of days needed to compute the RSI

RSIThreshold = self.GetParameter("RSI Threshold") #Threshold used to determine if RSI produces buy signal. If RSI reaches below threshold, then the indicator produces a buy signal. (default = 30)

LimitOrderThreshold = self.GetParameter("Limit Order Threshold") #Threshold used to compute the limit price when the system signals to buy the stocks. The limit price = previous close - Limit Order Threshold*previous close (default = 4%)

** #Exit Parameters**

ATRMultiplier = self.GetParameter("ATR Stop Loss Factor") #Multiplier of ATR used for computing the stop-loss

ProfitTarget = self.GetParameter("Profit Target: ") #Threshold for Profit Target

ExitDays = self.GetParameter("Exit Signal Period") #Number of days to wait for an exit signal (either a stop-loss or hitting the profit target). If there is neither a stop-loss or profit target, the system will exit after the exit signal period.

** #Set Default Parameter Values**

self.value_TradingEquity = 100,000 if TradingEquity is None else float(TradingEquity)

self.value_FixedFractionalRisk = 0.02 if FixedFractionalRisk is None else float(FixedFractionalRisk)

self.value_MinVolumeDays = 50 if MinVolumeDays is None else int(MinVolumeDays)

self.value_MinStockPrice = 1 if MinStockPrice is None else float(MinStockPrice)

self.value_MaxPosition = 10 if MaxPosition is None else int(MaxPosition)

self.value_MADays = 150 if MADays is None else int(MADays)

self.value_ADXDays = 7 if ADXDays is None else int(ADXDays)

self.value_ADXThreshold = 45 if ADXThreshold is None else int(ADXThreshold)

self.value_ATRDays = 10 if ATRDays is None else int(ATRDays)

self.value_RSIDays = 3 if RSIDays is None else int(RSIDays)

self.value_RSIThreshold = 30 if RSIThreshold is None else int(RSIThreshold)

self.value_LimitOrderThreshold = 0.04 if LimitOrderThreshold is None else float(LimitOrderThreshold)

self.value_ATRMultiplier = 2.5 if ATRMultiplier is None else float(ATRMultiplier)

self.value_ProfitTarget = 0.03 if ProfitTarget is None else float(ProfitTarget)

self.value_ExitDays = 4 if ExitDays is None else int(ExitDays)

self.SetStartDate(2017, 1, 1) #Set Start Date

self.SetEndDate(2017, 6, 30) #Set End Date

self.SetCash(100000) #Set Strategy Cash

** # use daily historical data and construct the universe according to the screennng criteria**

self.UniverseSettings.Resolution = Resolution.Daily

self.AddUniverse(self.CoarseSelectionFunction)

** #To determine the number of positions and update existing positions, make a storage for the list of entry orders and exit orders**

self.__openLimitOrders = [] #Stores Entry Limit Orders not yet filled

self.__filledLimitOrders = [] #Stores Entry Limit Orders that are filled (i.e., existing positions)

self.__openStopMarketOrder = [] #Stores Exit Stop Market Orders not yet filled

self.__filledStopMarketOrder = [] #Stores Exit Stop Market Orders that are filled

#We also create a list of dates when there is no exit signal

self.__daysWithoutExitSignal = []

** def CoarseSelectionFunction(self, coarse):**

Filtered_Universe = []

#Runtime Error: AttributeError : 'CoarseFundamental' object has no attribute 'symbol'

# at CoarseSelectionFunction in main.py:line 87

#AttributeError : 'CoarseFundamental' object has no attribute 'symbol' (Open Stacktrace)

for x in coarse:

ticker_symbol = x.Symbol

Volume_Dollar = x.DollarVolume

Volume_Share = x.Volume

self.min_dollar_volume = IndicatorExtensions.MIN(Volume_Dollar, self.value_MinVolumeDays)

self.min_volume = IndicatorExtensions.MIN(Volume_Share, self.value_MinVolumeDays)

self.low_price = self.Securities[ticker_symbol].Low

#We only want equities that satisfy the following screening criteria

#US stocks, min volume of last 50 trading days above 500K shares

#Min price of $1 per share

#Min dollar volume of $2.5M over same 50 day time period

if self.min_dollar_volume > 2500000 and self.low_price > self.value_MinStockPrice and self.min_volume > 500000:

Filtered_Universe.append(x)

#For every stock that satisfy the screening criteria, compute the RSI

for x in Filtered_Universe:

x.RS_Index = RelativeStrengthIndex(x.Symbol, self.value_RSIDays, Resolution.Daily)

#Then, sort the stocks according to the highest RSI:

Filtered_Universe.sort(key=lambda x: x.RS_Index, reverse=True)

** return [i.Symbol for i in Filtered_Universe]**