6. Built-in Strategies
There are more than 70 built-in trading strategies in qteasy, all of which can be used directly. By modifying the parameters of these trading strategies, different personalized effects can be easily achieved.
There are complete documentation for all built-in trading strategies in qteasy, providing detailed descriptions of trading strategies, parameter descriptions, and default parameter values. Each built-in trading strategy in qteasy has a unique ID, through which users can easily obtain this trading strategy, view the documentation, or use this trading strategy directly when creating an Operator object.
Access Built-in Strategies
List all built-in trading strategies, or filter some trading strategies based on ID. Use the following function:
The following function accepts the same parameter stg_id, but returns different types of data. If stg_id is None, all built-in trading strategies are returned, otherwise the specified ID trading strategy is returned. If the stg_id entered by the user does not exist, qteasy will return the trading strategy closest to the id entered by the user based on the stg_id entered by the user.
The following function returns a dictionary, where the key of the dictionary is the ID of the trading strategy and the value is the documentation of the trading strategy.
- qteasy.built_ins(stg_id: Optional[str] = None) dict[source]
Access or filter built-in trading strategies, which can be matched by stg_id, and return a dictionary of strategies
- Parameters:
stg_id (str, optional) – Strategy ID or fragment of ID, used to filter the required strategy. If stg_id is None, a dictionary of all built-in strategies is returned. Fuzzy matching is supported, for example, ‘cross’ can match ‘crossline’
- Returns:
strategies – A dictionary of all filtered built-in strategies
- Return type:
dict,
Examples
>>> import qteasy as qt >>> qt.built_in_list() { 'crossline': qteasy.built_in.CROSSLINE, 'macd': qteasy.built_in.MACD, 'dma': qteasy.built_in.DMA, 'trix': qteasy.built_in.TRIX, ... 'ndaychg': qteasy.built_in.SelectingNDayChange, 'ndayvol': qteasy.built_in.SelectingNDayVolatility } >>> qt.built_in_list('cross') { 'crossline': qteasy.built_in.CROSSLINE, }
Following function returns a list, the elements of which are the ID or name of the trading strategy.
- qteasy.built_in_list(stg_id: Optional[str] = None) list[source]
Access a list of built-in trading strategy IDs, which can be matched by stg_id
- Parameters:
stg_id (str, Optional) – Strategy ID or fragment of ID, used to filter the required strategy. If stg_id is None, a dictionary of all built-in strategies is returned. Fuzzy matching is supported, for example, ‘cross’ can match ‘crossline’
- Returns:
stg_ids – A list of IDs of all built-in strategies that meet the filtering criteria
- Return type:
list,
Examples
>>> import qteasy as qt >>> qt.built_in_list() ['crossline', 'macd', 'dma', 'trix', ... 'ndaychg', 'ndayvol',] >>> qt.built_in_list('cross') ['crossline']
- qteasy.built_in_strategies(stg_id: Optional[str] = None) list[source]
Acquire a list of built-in trading strategy objects, which can be matched by stg_id
- Parameters:
stg_id (str, Optional) – Strategy ID or fragment of ID, used to filter the required strategy. If stg_id is None, a dictionary of all built-in strategies is returned. Fuzzy matching is supported, for example, ‘cross’ can match ‘crossline’
- Returns:
strategies – A list of all filtered built-in strategy objects
- Return type:
list,
Examples
>>> import qteasy as qt >>> qt.built_in_strategies() [ qteasy.built_in.CROSSLINE, qteasy.built_in.MACD, qteasy.built_in.DMA, qteasy.built_in.TRIX, ... qteasy.built_in.SelectingNDayChange, qteasy.built_in.SelectingNDayVolatility ] >>> qt.built_in_strategies('cross') [ qteasy.built_in.CROSSLINE, ]
See also
If you want to get a built-in trading strategy object, you need to use the following function, which returns a built-in strategy object based on the ID entered by the user. If the user enters an incorrect ID, the function will report an error and provide a suggested ID:
- qteasy.get_built_in_strategy(stg_id: str) BaseStrategy[source]
Access Trading Strategy by ID
- Parameters:
stg_id (str) – Strategy ID
- Returns:
stg
- Return type:
内置交易策略对象
- Raises:
TypeError – If id is not a string:
ValueError – If id is not a built-in strategy ID:
Examples
>>> import qteasy as qt >>> qt.get_built_in_strategy('macd') RULE-ITER(MACD)
If you want to view the documentation of a built-in trading strategy, you need to use the following function, which returns a built-in strategy object based on the ID entered by the user. If the user enters an incorrect ID, the function will report an error and provide a suggested ID:
- qteasy.built_in_doc(stg_id: str, print_out: bool = False) Optional[str][source]
Access the documentation of a built-in strategy, stg_id must be correctly given and exist
- Parameters:
stg_id (str) – Strategy ID
print_out (bool, optional) – Whether to print the docstring directly. If False, only return the docstring.
- Returns:
doc_string – Returns the documentation string of the strategy, with special characters filtered out
- Return type:
str,
Examples
>>> import qteasy as qt >>> qt.built_in_doc('macd', print_out=True) MACD择时策略类,运用MACD均线策略,生成目标仓位百分比 -------------------- 策略参数: s: int, 短周期指数平滑均线计算日期; l: int, 长周期指数平滑均线计算日期; m: int, MACD中间值DEA的计算周期; 信号类型: PT型: 目标仓位百分比 信号规则: 计算MACD值: 1,当MACD值大于0时,设置仓位目标为1 2,当MACD值小于0时,设置仓位目标为0 策略属性缺省值: 默认参数: (12, 26, 9) 数据类型: close 收盘价,单数据输入 窗口长度: 270 参数范围: [(10, 250), (10, 250), (5, 250)] 策略不支持参考数据,不支持交易数据 >>> qt.built_in_doc('macde') ValueError: No built-in strategy found for macde, maybe you mean macd?
7. All Built-in Strategies
Here are the documentation of all built-in trading strategies, users can choose the appropriate trading strategy according to their needs.
All strategies that do not rely on other technical analysis packages
Following strategies do not rely on other technical analysis packages, they are based on simple calculations of historical data and do not require support from other technical analysis packages, they can be called directly.
Simple Stock Selection Strategies
Select stocks based on historical data
- qteasy.built_in.SelectingAvgIndicator(par_values=(True, 'even', 'greater', 0, 0, 0.25))[source]
- Select stocks based on the average value of financial indicators of stocks over a period of time
Basic stock selection strategy. Select stocks based on the average value of historical indicators of stocks, factor sorting parameters can be passed in as strategy parameters to change the strategy data type, select stocks based on different historical data, and select stock parameters can be passed in through par_values
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
sort_ascending:enum, Whether to sort the factor in ascending orderTrue: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:enum, Weighting of stock position allocation ratioeven: Default value, all selected stocks get the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
condition: enum, Stock selection conditionany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Stock screening lower limit, default valuenp.-infubound:float, Stock screening upper limit, default valuenp.infmax_sel_count:float, The number of stocks extracted (p>=1) or the proportion (p<1), default value: 0.5, indicating that 50% of the stocks are selected
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Determine a data type using data_types, take the average of the past datatypes data of the stock, and use this average value as the stock selection factor for stock selection
- Default Values of Strategy Attributes
Default Parameters:
(True, 'even', 'greater', 0, 0, 0.25)Data Type:
epsEarnings per share, single data inputWindow Length:
270Range of Parameters:
[(True, False),('even', 'linear', 'proportion'),``(‘any’, ‘greater’, ‘less’, ‘between’, ‘not_between’)’’, ``,’’
(-np.inf, np.inf),’’(-np.inf, np.inf),’’(0, 1.)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNDayLast(par_values=(2,))[source]
Select stocks based on the price or data indicators of the stock N days ago as the stock selection factor. The historical data of the stock N days ago is used as the stock selection factor, and the factor sorting parameters are controlled in the form of strategy attributes
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n: int, The lead period of historical data of stocks- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Select stocks using historical data from N days ago as stock selection factors in each stock selection cycle
Control the stock selection method through the following strategy attributes:
max_sel_count:float, Stock selection limit, indicating the maximum number of stocks selected, default value:0.5, indicating that 50% of the stocks are selectedcondition:str, Determine the stock screening condition, default valueanyany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Lower bound of the indicator when executing the condition screening, default valuenp.-infubound:float, Upper bound of the indicator when executing the condition screening, default valuenp.infsort_ascending:bool, Sorting method, default value:False,True: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:str, Determine how to allocate the weights of selected stocks, default value:eveneven: All selected stocks receive the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
- Default Values of Strategy Attributes
Default Parameters:
(2,)Data Type:
closeClosing price, single data inputWindow Length:
100Range of Parameters:
[(2, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNDayAvg(par_values=(14,))[source]
Select stocks based on the average value of the price or data indicators of the stock in the past N days as the stock selection factor. The average value of the historical data of the stock in the previous N days is used as the stock selection factor, and the factor sorting parameters are controlled in the form of strategy attributes
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n: int, selection period of stock history data
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Select stocks using historical data from N days ago as stock selection factors in each stock selection cycle
Control the stock selection method through the following strategy attributes:
max_sel_count:float, Stock selection limit, indicating the maximum number of stocks selected, default value:0.5, indicating that 50% of the stocks are selectedcondition:str, Determine the stock screening condition, default valueanyany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Lower bound of the indicator when executing the condition screening, default valuenp.-infubound:float, Upper bound of the indicator when executing the condition screening, default valuenp.infsort_ascending:bool, Sorting method, default value:False,True: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:str, Determine how to allocate the weights of selected stocks, default value:eveneven: All selected stocks receive the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow length:
150Parameter range:
[(2, 150)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNDayChange(par_values=(14,))[source]
Stock selection based on price or data changes of a stock over the past n days as a stock selection factor Basic stock selection strategy: Stock selection based on price or data changes of a stock over the past n days as a stock selection factor
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n: int, selection period of stock history data
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Stock selection is done in each stock picking cycle using the value of the price change in the past N days as a stock picking factor.
Control the stock selection method through the following strategy attributes:
max_sel_count:float, Stock selection limit, indicating the maximum number of stocks selected, default value:0.5, indicating that 50% of the stocks are selectedcondition:str, Determine the stock screening condition, default valueanyany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Lower bound of the indicator when executing the condition screening, default valuenp.-infubound:float, Upper bound of the indicator when executing the condition screening, default valuenp.infsort_ascending:bool, Sorting method, default value:False,True: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:str, Determine how to allocate the weights of selected stocks, default value:eveneven: All selected stocks receive the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
- Default Values of Strategy Attributes
Default parameters: (14,)
Data Type: close Close, Single Data Entry
Window length: 150
Parameter range: [(2, 150)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNDayRateChange(par_values=(14,), **kwargs)[source]
Stock selection based on the percentage change in a stock’s price or data indicator over the past n days Basic stock selection strategy: Stock selection based on the percentage change in a stock’s price over the past n days
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n:int, selection period for stock history data- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Stock picking using the rate of price change over the past N days as a stock picking factor in each stock picking cycle
Control the stock selection method through the following strategy attributes:
max_sel_count:float, Stock selection limit, indicating the maximum number of stocks selected, default value:0.5, indicating that 50% of the stocks are selectedcondition:str, Determine the stock screening condition, default valueanyany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Lower bound of the indicator when executing the condition screening, default valuenp.-infubound:float, Upper bound of the indicator when executing the condition screening, default valuenp.infsort_ascending:bool, Sorting method, default value:False,True: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:str, Determine how to allocate the weights of selected stocks, default value:eveneven: All selected stocks receive the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow length:
150Parameter range:
[(2, 150)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNDayVolatility(par_values=(14,))[source]
Stock selection factor based on the stock price volatility of the stock over the previous N days
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n:int, selection period for stock history data- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Use price volatility over the past N days as a stock picking factor in each stock picking cycle.
Control the stock selection method through the following strategy attributes:
max_sel_count:float, Stock selection limit, indicating the maximum number of stocks selected, default value:0.5, indicating that 50% of the stocks are selectedcondition:str, Determine the stock screening condition, default valueanyany: Default value, select all available stocksgreater: Filter stocks with factors greater thanuboundless: Filter stocks with factors less thanlboundbetween: Filter stocks with factors betweenlboundanduboundnot_between: Filter stocks with factors not betweenlboundandubound
lbound:float, Lower bound of the indicator when executing the condition screening, default valuenp.-infubound:float, Upper bound of the indicator when executing the condition screening, default valuenp.infsort_ascending:bool, Sorting method, default value:False,True: Prioritize stocks with the smallest factor,False, Prioritize stocks with the largest factor
weighting:str, Determine how to allocate the weights of selected stocks, default value:eveneven: All selected stocks receive the same weightlinear: The weight is linearly distributed according to the factor rankingdistance: The weight of the stock is proportional to the difference (distance) between their indicators and the minimumproportion: The weight is proportional to the factor score of the stock
- Default Values of Strategy Attributes
Default parameters:
(14,)Data type:
high,low,closeHighest price, lowest price, closing price, multiple data entryWindow length:
150Parameter range:
[(2, 150)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SignalNone()[source]
- Empty Trading Signal Strategy.
Strategies that do not generate any trading signals
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
none
- Signal Type
PT Type: Percentage Position Ratio Signal
Type PS: Percentage Buy/Sell Signal
Type VS: Buy/Sell Signal
- Rules
No trading signals are generated during the entire signal cycle
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SellRate(par_values=(20, 0.1))[source]
- Rate of Change Sell Signal Strategy.
Sell signals are generated when the rate of change in price exceeds the threshold. This strategy does not generate buy signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``day`’’, ``int`’, period for calculating the rate of rise and fall
change,float, up/down thresholds- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
A sell signal is generated when.
1, -1 sell signal generated when
change> 0 anddaydaily increase is greater thanchange2, a -1 sell signal is generated when
change< 0 and thedaydaily decline is greater than thechange- Default Values of Strategy Attributes
Default parameters:
(20, 0.1)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(1, 100), (-0.5, 0.5)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.BuyRate(par_values=(20, 0.1))[source]
- Rate of Change Buy Signal Strategy.
A buy signal is generated when the rate of change in price exceeds the threshold. This strategy does not generate sell signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``day`’’, ``int`’, period for calculating the rate of rise and fall
change,float, up/down thresholds- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
A buy signal is generated when.
1, 1 buy signal is generated when change > 0 and the daily increase is greater than change
2, 1 buy signal generated when change < 0 and day daily drop is greater than change
- Default Values of Strategy Attributes
Default parameters:
(20, 0.1)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(1, 100), (-0.5, 0.5)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingAll()[source]
Basic Stock Picking Strategy: Keep all stocks in the historical stock pool selected, with an even split of the investment.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``none’’
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Positions are constant throughout the signal cycle and are the same for all portfolios
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingNone()[source]
Basic Stock Picking Strategy: Keep all stocks in the historical stock pool unchecked and invest in 0 positions.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``none’’
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Position ratios are constant throughout the signaling cycle and all portfolios have a position ratio of 0
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SelectingRandom(par_values=(0.5,))[source]
- Basic stock selection strategy: In each historical segment, a number of stocks are randomly selected at a specified percentage (at p<1) of the total number of stocks.
Or a specified number (p>=1) of stocks are randomly selected into the portfolio and the investment ratio is equally distributed
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:float, number of shares drawn (p>=1) or proportion (p<1)- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
When p>=1, p stocks are randomly selected from the pool of all stocks and all selected stocks are set to have a position ratio of 1/p
When 0>p>1, a number of stocks are drawn from the stock pool in proportion to p, and all stocks are set to have the same percentage of positions and the sum is 1
- Default Values of Strategy Attributes
Default parameters:
(0.5, )Data Type:
closeClosing price, single data inputWindow Length:
100Parameter range:
[(0, np.inf)]
Reference data is not supported, and trading data is not supported
Simple timing strategy
- qteasy.built_in.TimingLong()[source]
Simple timing strategy with a long full position fixed throughout the historical cycle
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
No policy parameters
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Constant 100% full position throughout the signal cycle
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.TimingShort()[source]
Simple timing strategy with a fixed short position throughout the historical cycle
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``none’’
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Position ratio constant throughout the signal cycle -100% short full position
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.TimingZero()[source]
Simple timing strategy with fixed short positions throughout the historical cycle
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
``none’’
- Signal Type
PT Type: Percentage Position Ratio Signal
- Rules
Positions are held at a constant 0% short throughout the signal cycle
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
Timing Strategy Based on SMA Indicators
The following stock picking strategies are all based on the stock price averaging indicator to determine buy and sell
- qteasy.built_in.DMA(par_values=(12, 26, 9), **kwargs)[source]
DMA timing strategy
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
s,int, short averaging periodl,int, long mean periodd,int, DMA period- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
A buy signal is generated when.
1, DMA above AMA, long range, i.e., the DMA line crosses the AMA line from bottom to top, the output is 1
2, DMA below the AMA, short range, that is, the DMA line from top to bottom across the AMA line, the output is 0 3, DMA and the stock price divergence when the crossover signal, the credibility of higher
- Default Values of Strategy Attributes
Default parameters:
(12, 26, 9)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(10, 250), (10, 250), (8, 250)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.MACD(par_values=(12, 26, 9))[source]
MACD timing strategy class, using the MACD averaging strategy to generate target position percentages
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
s:int, short period exponential smoothing average calculation date;l:int, date of calculation of long period exponential smoothing averages;m:int, the period for which the MACD median DEA is calculated;- Signal Type
Type PT: Percentage of Target Position
- Rules
Calculate
MACDvalue: 1, set position target to 1 whenMACDvalue is greater than 02, When the
MACDvalue is less than 0, set the position target to 0- Default Values of Strategy Attributes
Default parameters:
(12, 26, 9)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(10, 250), (10, 250), (5, 250)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.TRIX(par_values=(12, 12), **kwargs)[source]
TRIX timing strategy that uses triple smoothed exponential moving averages of stock prices to make long/short judgments
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
s: int, SMA parameter in days, used to compute the triple-smoothed exponential moving average with period S TRIXm: int, smoothed mean parameter, used to calculate the M-day simple moving average of TRIX- Signal Type
Type PT: Percentage of target position ``
- Rules
Calculate the triple-smoothed exponential moving average of the price TRIX, and then calculate the moving average of the M-day TRIX:.
1,
TRIXis aboveMATRIX, set position target to 12, ``TRIX``位于``MATRIX``下方时,设置仓位目标位-1
- Default Values of Strategy Attributes
Default parameters:
(12, 12)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 50), (3, 150)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.CROSSLINE(par_values: tuple = (35, 120, 0.02))[source]
Crossline timing strategy class, using the cross of long and short averages to determine long and short status
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
s:int, date of short average calculationl:int, date of calculation of long averagesm:float, width of mean boundary (in percent)- Signal Type
Type PT: Percentage of Target Position
- Rules
1, When the short SMA is above the long SMA and the distance is greater than l*m%, set the position target to 1
2, When the short SMA is below the long SMA and the distance is greater than l*m%, set the position target to -1
3, When the distance between the long and short averages is not greater than l*m%, set the position target to 0
- Default Values of Strategy Attributes
Default parameters:
(35, 120, 0.02)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(10, 250), (10, 250), (0, 1)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.CDL()[source]
CDL timing strategy, find the cdldoji pattern in the K chart that meets the requirements
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
None
- Signal Type
Type PS: Percentage Trading Signal
Type VS: Volume Signal
- Rules
Search for CDL Doji patterns (match score between 0 and 100) within the historical data window, sum them and divide by 100 to calculate.
Equivalent CDL Doji match count, using the match count as the trading signal.
- Default Values of Strategy Attributes
Default parameters:
()Data type:
open, high, low, closeopen, high, low, closeWindow Length:
100Parameter range:
None
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SoftBBand(par_values=(20, 2, 2, 0))[source]
The Bollinger Bands progressive trading strategy, which determines long and short based on the relationship between the stock price and the upper and lower Bollinger Bands.
Trading signals are not generated all at once, but gradually and progressively buy and sell.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p: int, SMA period, used to calculate the SMA period of a Bollinger band lineu: float, upper track offset in multiples of standard deviation, e.g. 2 means upper offset 2 times standard deviationd: float, lower track offset in multiples of standard deviation, e.g. 2 means lower offset 2 times standard deviationm: int, moving average type, value range 0~8, indicates 9 different types of averages.- Signal Type
Type PS: Percentage Example Trading Signals
- Rules
Calculate the BBAND and check if the price exceeds the upper or lower rail of the BBAND:.
1, when the price is greater than the upper rail, the proportion of 10% per day to generate buy trading signals
2, when the price is below the lower rail, a 33% ratio of sell signals are generated every day
- Default Values of Strategy Attributes
Default parameters:
(20, 2, 2, 0)Data Type:
closeClosing price, single data inputWindow length: ``200`’’
Parameter range:
[(2, 100), (0.5, 5), (0.5, 5), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.BBand(par_values=(20, 2, 2))[source]
Bollinger Bands trading strategy, which determines long and short positions based on the relationship between a stock’s price and the upper and lower Bollinger Bands, and generates trading signals when the price crosses above or below the upper and lower Bollinger Bands. Bollinger Bands are not available as SMAs.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, SMA period, used to calculate the SMA period of a Bollinger band lineu:float, upper track offset in multiples of standard deviation, e.g. 2 means upper offset 2 times standard deviationd:float, lower track offset in multiples of standard deviation, e.g. 2 means lower offset 2 times standard deviation- Signal Type
Type PS: Percentage Example Trading Signals
- Rules
Calculate the
BBANDand check whether the price exceeds the upper or lower rail of theBBAND.1, when the price goes up through the upper rail, generating a full buy signal
2, When the price goes below the lower rail, a full sell signal is generated ``
- Default Values of Strategy Attributes
Default parameters:
(20, 2, 2)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 100), (0.5, 5), (0.5, 5)]
Reference data is not supported, and trading data is not supported
Trading strategies that rely on the TA-Lib technical analysis package
Below are some trading strategies that rely on the TA-Lib technical analysis package, which is based on the calculations of the TA-Lib technical analysis package and requires the installation of the TA-Lib technical analysis package.
Timing strategy based on a single mean crossing
The following stock picking strategies are all based on whether or not the stock price crosses above/below the SMA to determine a buy-sell decision
- qteasy.built_in.SCRSSMA(par_values=(14,))[source]
Single SMA Crossover Strategy - SMA (Simple Moving Average): Positions are set based on the relative position of the stock price to the SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
rng:int, period of calculation of averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 250)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSDEMA(par_values=(14,))[source]
Single SMA Crossover Strategy - DEMA SMA (Double Exponential Smoothing Moving Average): Positions are set based on the relative position of the stock price to the DEMA SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
rng:int, period of calculation of averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 250)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSEMA(par_values=(14,))[source]
Single SMA Crossover Strategy - EMA (Exponential Smoothed Moving Average): Positions are set based on the relative position of the stock price to the EMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
rng:int, period of calculation of averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 250)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSHT(par_values=())[source]
Single SMA Crossover Strategy - HT (Hilbert Transform Instantaneous Trendline): Positions are set based on the relative position of the stock price to the HT line.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
No parameters required
- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the HT line, set the position ratio to 1
2, when the price is below the HT line, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
()Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSKAMA(par_values=(14,))[source]
Single SMA Crossover Strategy - KAMA SMA (Kaufman Adaptive Moving Average): Positions are set based on the relative position of the stock price to the KAMA SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
rng:int, period of calculation of averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 250)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSMAMA(par_values=(0.5, 0.05))[source]
Single SMA Crossover Strategy - MAMA SMA (MESA Adaptive Moving Average): Positions are set based on the relative position of the stock price to the MAMA SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:floatbetween 0 and 1, fast moving limit
- ``
s:floatbetween 0 and 1, slow moving limit- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
- ``
1, when the price is above the average, set the position ratio to 1
- ``
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(0.5, 0.05)
- ``
Data Type:
closeClosing price, single data input
- ``
Window Length:
270
- ``
Parameter range:
[(0.01, 0.99), (0.01, 0.99)]Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRST3(par_values=(12, 0.5))[source]
Single SMA Crossover Strategy - T3 SMA (Triple Exponential Smoothing Moving Average): Positions are set based on the relative position of the stock price to the T3 SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periodsv:floatv-factor, adjustment factor, value range 0 to 1- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(12, 0.5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 20), (0, 1)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSTEMA(par_values=(6,))[source]
Single SMA Crossover Strategy - TEMA SMA (Triple Exponential Smoothing Moving Average): Positions are set based on the relative position of the stock price to the TEMA SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periods- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(6,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(2, 20)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSTRIMA(par_values=(14,))[source]
Single SMA Crossover Strategy - TRIMA SMA (Triple Exponential Smoothing Moving Average): Positions are set based on the relative position of the stock price to the TRIMA SMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periods- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 200)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SCRSWMA(par_values=(14,))[source]
Single SMA Crossover Strategy - WMA (Weighted Moving Average): Positions are set based on the relative position of the stock price to the WMA.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periods- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Check the current price in relation to the averages.
1, when the price is above the average, set the position ratio to 1
2, when the price is below the average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(14,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(3, 200)]’’
Reference data is not supported, and trading data is not supported
Timing Strategy Based on Double SMA Crossing
The following stock picking strategies are all based on whether or not the two (one fast and one slow) averages cross to determine buy and sell
- qteasy.built_in.DCRSSMA(par_values=(125, 25))[source]
Double SMA Crossover Strategy - SMA (Simple Moving Average): Based on the SMA calculation rules to generate two averages, fast and slow, according to the relative position of the fast and slow averages to set the proportion of positions
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
l:int, long period, calculated period for slow averagess:int, short period, calculated period for fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (3, 250)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSDEMA(par_values=(125, 25))[source]
Double SMA Crossover Strategy - DEMA SMA (Simple Moving Average): Based on the DEMA SMA calculation rules to generate two SMAs, fast and slow, according to the relative position of the fast and slow SMAs to set the proportion of the positions
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
l:int, long period, calculated period for slow averagess:int, short period, calculated period for fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (3, 250)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSEMA(par_values=(20, 5))[source]
Double SMA Crossover Strategy - EMA SMA (Exponential Smoothing Moving Average): Generate two SMAs, fast and slow, based on the EMA SMA calculation rules, and set position ratios based on the relative positions of the fast and slow SMAs.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
l:int, long period, calculated period for slow averagess:int, short period, calculated period for fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (3, 250)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSKAMA(par_values=(125, 25))[source]
Double SMA Crossover Strategy - KAMA SMA (Kaufman Adaptive Moving Average): Generate two SMAs, fast and slow, based on KAMA SMA calculation rules, and set position ratios based on the relative positions of the fast and slow SMAs.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
l:int, long period, calculated period for slow averagess:int, short period, calculated period for fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
Default value of policy attribute: Default parameter:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (3, 250)]Strategy does not support reference data, does not support transaction data
- qteasy.built_in.DCRSMAMA(par_values=(0.15, 0.05, 0.55, 0.25))[source]
Double SMA Crossover Strategy - MAMA SMA (MESA Adaptive Moving Average): Generate two SMAs, fast and slow, based on the MAMA SMA calculation rules, and set position ratios based on the relative positions of the fast and slow SMAs.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
lf:float, long period fast moving limit, KAMA calculation parameters for slow averagesls:float, long period slow moving limit, KAMA calculation parameter for slow averagessf:float, short-period fast moving limit, KAMA calculation parameter for fast averagesss:float, short-period slow-moving limits, KAMA calculation parameters for fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(0.15, 0.05, 0.55, 0.25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(0.01, 0.99), (0.01, 0.99), (0.01, 0.99), (0.01, 0.99)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRST3(par_values=(20, 0.5, 5, 0.5))[source]
Double SMA Crossover Strategy - T3 SMA (Triple Exponential Smoothing Moving Average): Generate fast and slow SMAs based on the T3 SMA calculation rules, and set position ratios based on the relative positions of the fast and slow SMAs.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
lp:intlong period parameter for calculating slow averageslv:floatLong-period v-factor, adjustment factor, value between 0 and 1, used to calculate slow averagessp:intShort-period parameter for calculating fast averagessv:floatShort-period v-factor, adjustment factor, value between 0 and 1, used to calculate fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(20, 0.5, 5, 0.5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 20), (0, 1), (2, 20), (0, 1)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSTEMA(par_values=(11, 6))[source]
Double SMA Crossover Strategy - TEMA SMA (Triple Exponential Smoothing Moving Average): Based on the TEMA SMA calculation rules to generate fast and slow SMAs, based on the relative position of the fast and slow SMAs to set the proportion of positions
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
lp:intlong period parameter for calculating slow averagessp:intShort-period parameter for calculating fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(11, 6)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 20), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSTRIMA(par_values=(125, 25))[source]
- Double SMA Crossover Strategy - TRIMA SMA (Triple Exponential Smoothing Moving Average).
Generate fast and slow averages based on TRIMA averages calculation rules, and set position ratios based on the relative positions of the fast and slow averages.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
lp:intlong period parameter for calculating slow averagessp:intShort-period parameter for calculating fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 200), (3, 200)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DCRSWMA(par_values=(125, 25))[source]
- Double SMA Crossover Strategy - WMA SMA (Weighted Moving Average).
Generate fast and slow averages based on the WMA calculation rules, and set the position ratio based on the relative positions of the fast and slow averages.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
lp:intlong period parameter for calculating slow averagessp:intShort-period parameter for calculating fast averages- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the slow and fast averages using both long and short periods.
1, when the fast averages are higher than the slow averages, set the position ratio to 1
2, when the slow average is higher than the fast average, set the position ratio to -1
- Default Values of Strategy Attributes
Default parameters:
(125, 25)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 200), (3, 200)]
Reference data is not supported, and trading data is not supported
Timing Strategy Based on SMA Slope
The following stock picking strategies are all based on the slope of the averages to determine buy and sell
- qteasy.built_in.SLPSMA(par_values=(35, 5))[source]
SMA Slope Trading Strategy - SMA (Simple Moving Average): Generate moving averages based on the SMA calculation rules and set position targets based on the slope of the averages (when the slope of the averages is positive, it indicates an upward price trend and increases the percentage of the position, when the slope of the averages is negative, it indicates a downward trend and sets the percentage of the position at minus one or zero)
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, period of calculation of averagesN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(35, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPDEMA(par_values=(35, 5))[source]
SMA Slope Trading Strategy - DEMA SMA (Double Exponential Smoothing Moving Average): Generate moving averages based on the DEMA calculation rules, and set position ratio targets based on the slope of the averages (when the slope of the averages is positive, it means that the price trend is upward, so increase the position ratio, when the slope of the averages is negative, it means that the trend is downward, so set a position ratio of minus one or zero). (When the slope of the SMA is negative, the trend is downward and the position is set at minus one or zero)
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, period of calculation of averagesN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(35, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPEMA(par_values=(35, 5))[source]
SMA Slope Trading Strategy - EMA SMA (Exponential Smoothing Moving Average): Generate moving averages based on the EMA calculation rules, and set position targets based on the slopes of the averages (when the slopes of the averages are positive, it indicates an upward price trend and increases the percentage of the position, when the slopes of the averages are negative, it indicates a downward trend and sets the position percentage to (when the slope of the SMA is positive, the price is trending upwards, increase your position, when the slope of the SMA is negative, the price is trending downwards, set your position to minus one or zero)
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, period of calculation of averagesN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1``.- Default Values of Strategy Attributes
Default parameters:
(35, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPHT(par_values=(5,))[source]
SMA Slope Trading Strategy - HT SMA (Hilbert Transform - Instantaneous Trendline): Generate moving averages based on the HT calculation rules, set position targets based on the slope of the averages (when the slope of the averages is positive, it indicates an upward price trend, increase the position ratio). (when the slope of the SMA is positive, the price is trending upwards and the position is increased, when the slope of the SMA is negative, the price is trending downwards and the position is set to minus one or zero).
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
N:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(5,)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range: ``[(2, 20)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPKAMA(par_values=(35, 5))[source]
SMA Slope Trading Strategy - KAMA SMA (Kaufman Adaptive Moving Average): Generate moving averages based on the KAMA calculation rules, and set position targets based on the slopes of the averages (when the slopes of the averages are positive, it means that the price is trending upwards, so increase the percentage of the position, when the slopes of the averages are negative, it means that the trend is going downwards, so set the percentage of the position at minus one or zero). (When the slope of the SMA is negative, the trend is downward and the position is set at minus one or zero)
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, period of calculation of averagesN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is setexampleto 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(35, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 250), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPMAMA(par_values=(0.5, 0.05, 5))[source]
SMA Slope Trading Strategy - MAMA SMA (MESA Adaptive Moving Average): Generate moving averages based on the MAMA calculation rules and set position targets based on the slopes of the averages (when the slopes of the averages are positive, indicating an upward trend in price, increase the percentage of the position, when the slopes are negative, indicating a downward trend, set the percentage of the position at minus one or zero). (When the slope of the SMA is negative, the trend is downward and the position is set at minus one or zero).
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:float, limit of high-speed movements:float, low-speed movement limitsN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(0.5, 0.05, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(0.01, 0.99), (0.01, 0.99), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPT3(par_values=(12, 0.25, 5))[source]
- SMA Slope Trading Strategy - T3 SMA (Triple Exponential Smoothing Moving Average).
Generate moving averages based on the T3 calculation rules and set position targets based on the slope of the averages (when the slope of the averages is positive, the price is trending upward and the position is increased, when the slope of the averages is negative, the trend is downward and the position is set at minus one or zero).
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periodsv:floatv-factor, adjustment factor, value range 0 to 1N:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(12, 0.25, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 20), (0, 1), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPTEMA(par_values=(6, 5))[source]
SMA Slope Trading Strategy - TEMA SMA (Triple Exponential Smoothing Moving Average): Generate moving averages based on the TEMA calculation rules and set position targets based on the slope of the averages (when the slope of the averages is positive, it indicates that the price is trending upwards, so increase the percentage of the position, when the slope of the averages is negative, it indicates that the trend is downwards, so set the percentage of the position at minus one or zero). (When the slope of the SMA is negative, the trend is downward and the position is set at minus one or zero)
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:intaverages calculate periodsN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(6, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(2, 20), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPTRIMA(par_values=(35, 5))[source]
SMA Slope Trading Strategy - TRIMA SMA (Triple Exponential Smoothing Moving Average): Generate moving averages based on the TRIMA calculation rules and set position targets based on the slopes of the averages (when the slopes of the averages are positive, it means that the price trend is upward and the position ratio is increased, when the slopes of the averages are negative, it means that the trend is downward and the position ratio is set at minus one or zero). (When the slope of the SMA is negative, the trend is downward and the position is set at minus one or zero).
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:intaverages calculate periodsN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(35, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 200), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SLPWMA(par_values=(125, 5))[source]
SMA Slope Trading Strategy - WMA SMA (Weighted Moving Average).
Generate moving averages based on the WMA calculation rules and set position targets based on the slope of the averages (when the slope of the averages is positive, the price is trending upward and the position is increased, when the slope of the averages is negative, the trend is downward and the position is set at minus one or zero).
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, averages calculate periodN:int, number of data points used to estimate slope- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the moving average of the price according to the rule and calculate the current slope of the average
slope.slopeis obtained by linear regression using the most recent N moving average data points:.1, when the slope of
slopeis greater than zero, the trend is judged to be upward, and the position ratio is set to 12, when the slope of
slopeis less than zero, the trend is judged to be downward, and the position ratio is set to -1- Default Values of Strategy Attributes
Default parameters:
(125, 5)Data Type:
closeClosing price, single data inputWindow Length:
270Parameter range:
[(3, 200), (2, 20)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.SAREXT(par_values=(0, 3))[source]
Extended parabolic SAR strategy with buy signals when the indicator is greater than 0 and sell signals when the indicator is less than 0
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
a:int, Parabolic SAR parameter: Accelerationm:float, maximum maximum value- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculation of
Parabolic SAR.1, when
Parabolic SARis greater than 0, the output is long2, output short when
Parabolic SARis less than 0- Default Values of Strategy Attributes
Default parameters:
(0, 3)Data types:
high,lowhigh and low, multiple data inputsWindow length:
200Parameter range:[(-100, 100), (0, 5)]
Reference data is not supported, and trading data is not supported
Timing Strategies Based on Momentum Technical Indicators
The following stock picking strategies are all based on the slope of the averages to determine buy and sell
- qteasy.built_in.ADX(par_values=(14,))[source]
ADX (Average Directional Movement Index) Stock Picking Strategy: Determine the strength of the current trend based on the ADX indicator and generate trading signals based on the strength of the trend.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, ADX computation time period, range 2 to 35- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate
ADXtrend strength according to the rule.1, When
ADX>25, the trend is judged to be upward and the position ratio is set to 12, When
between 20<ADX<25, it is judged to be a neutral trend, and the position ratio is set to 0.3, When
ADX>20, the trend is judged to be downward, and the position ratio is set to -1.- Default Values of Strategy Attributes
Default parameters:
(14,)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow Length:
270Parameter range: ``[(2, 35)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.APO(par_values=(12, 26, 0))[source]
APO Indicator (Absolute Price Oscillator) Stock Picking Strategy.
APO indicator is generated by the relative relationship between two averages, based on the APO indicator to determine the current trend of the stock price movements of bulls and bears, so as to generate trading signals based on the trend
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f:int, fast averaging periods:int, slow mean periodm:int, moving average type, value range 0-8- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate APO trends according to the rule:.
1, When
APOis greater than 0, it is judged to be a bullish trend and the position ratio is set to 12, When
ADXis less than 0, it is judged to be a bearish trend and the position ratio is set to -1.- Default Values of Strategy Attributes
Default parameters:
(12, 26, 0)Data Type:
closeClosing price, single data inputWindow length: ``200`’’
Parameter range:
[(10, 100), (10, 100), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.AROON(par_values=(14,))[source]
AROON Indicator Stock Picking Strategy.
The AROON indicator is used to determine whether the current stock price is in a trend range or a stalemate range, and by calculating the AROON indicator strategy can output strong long/short and weak long/short based on the strength of the trend.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, trend-determining cycle- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate the
AROONUP / DOWNtwo trend lines according to the rule and generate the position ratio signal:.1, Output weak long when UP is above DOWN
2, When UP is below DOWN, the output is weakly shorted
3, When UP is greater than 70 and DOWN is less than 30, the output of strong longs
4, When UP is less than 30 and DOWN is more than 70, the output is strong short
- Default Values of Strategy Attributes
Default parameters:
(14,)Data types:
high,lowHighest price, lowest price, multiple data inputsWindow length: ``200`’’
Range of Parameters:
[(2, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.CMO(par_values=(14,))[source]
CMO (Chande Momentum Oscillator) Stock Picking Strategy.
CMO is a momentum indicator that fluctuates between -100 and 100 and is used to determine whether a stock is currently in an oversold or overbought range, and is used by this strategy to generate investment position targets.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, momentum calculation period- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate
CMOaccording to the rules and generate position ratio signals:.1, output weak long when
CMOis greater than 02, Output weak short when
CMOis less than 03, Strong long output when
CMOis greater than 504, Strong short output when
CMOis less than -50- Default Values of Strategy Attributes
Default parameters:
(14,)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow length: ``200`’’
Range of Parameters:
[(2, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.MACDEXT(par_values=(12, 0, 26, 0, 9, 0))[source]
MACDEXT (Extendec MACD) Stock Picking Strategy.
This strategy uses the MACD indicator to generate position targets, but unlike the standard MACD, the type of MACDEXT fast, slow, and signal averages are optional!
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
fp:int, fast averages calculate period
- ``
ft:int, type of fast average, value range 0-8sp:int, slow SMA calculation periodst:int, slow SMA type, value range 0 to 8s:int, MACD signal line calculating periodt:int, MACD signal line type, value range 0-8- Signal Type
Type PT: Position Percentage Target Signal
- Rules
Calculate
MACDaccording to the rules and generate position ratio signals based on the H line of the MACD:.1, Outputs multiple when
hist>02, output null when
hist<0- Default Values of Strategy Attributes
Default parameters:
(12, 0, 26, 0, 9, 0)Data Type:
closeClosing price, single data inputWindow length: ``200`’’
Parameter range:
[(2, 35), (0, 8), (2, 35), (0, 8), (2, 35), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.MFI(par_values=(14,))[source]
MFI (Money Flow Index) Trading Strategy: MFI is used to determine whether a stock is overbought or oversold, this strategy uses the MFI indicator to generate trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, MFI signal calculation period- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate
MFIaccording to the rules and generate proportional trading signals based on the value of MFI:.1, 10% buy trade signal generated consistently when
MFI > 202, Continuous 30% sell signals are generated when
MFI > 80and positions are sold continuously- Default Values of Strategy Attributes
Default parameters:
(14,)Data types:
high,low,close,volumeHighest price, lowest price, closing price, volume, multiple data inputsWindow length: ``200`’’
Range of Parameters:
[(2, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DI(par_values=(14, 14))[source]
DI (Directory Indicator) Trading Strategy.
The DI indicator consists of a negative and a positive indicator, which indicate the strength of the upward and downward price trend, respectively, and this strategy uses the ±DI indicator to generate trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n:int, Negative DI signal calculation periodp:int, positive DI signal calculation period- Signal Type
Type PT: Percentage Position Target Signal
- Rules
Calculate positive and negative DI according to the rules and generate position target signals based on the value of DI:.
1, When
+DI > -DI, set position target to 12, When
+DI < -DI, set the position target to -1- Default Values of Strategy Attributes
Default parameters:
(14, 14)Data types:
high,low,closeHighest, lowest, closing, multiple data inputsWindow length: ``200`’’
Parameter range:
[(1, 100), (1, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.DM(par_values=(14, 14))[source]
DM (Directional Movement) Trading Strategy.
The DM indicator consists of Negative Directional Movement and Positive Directional Movement, which indicate upward and downward price trends, respectively. This strategy uses the ±DM indicator to generate trading signals
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n:int, negative DM signal calculation periodp:int, Positive DM signal calculation period- Signal Type
Type PT: Percentage Position Target Signal
- Rules
Calculate positive and negative DM according to the rule and generate position target signals based on the value of DM:.
1, When ``+DM > -D``M, set position target to 1
2, When ``+DM < -D``M, set the position target to -1
3, For the rest of the cases, set the position target to 0
- Default Values of Strategy Attributes
Default parameters:
(14, 14)Data types:
high,lowHighest price, lowest, multiple data inputsWindow length: ``200`’’
Parameter range:
[(1, 100), (1, 100)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.MOM(par_values=(14,))[source]
MOM (momentum indicator) Trading Strategy: The MOM indicator can be used to identify the strength of an uptrend or downtrend in price, with the MOM being positive when the current price is higher than the previous day’s price and negative when it is lower than the previous day’s price.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n:int, MOM signal calculation period- Signal Type
Type PT: Percentage Position Target Signal
- Rules
Calculate
MOMaccording to the rule and generate position target signals based on the value ofMOM:.1, when
MOM > 0, set position target to 12, When
MOM < 0, set the position target to -13, For the rest of the cases, set the position target to 0
- Default value of the strategy attribute:``
Default parameters:
(14, )Data Type:
closeClosing price, single data inputWindow Length:
100Parameter range: ``[(1, 100)]’’
Reference data is not supported, and trading data is not supported
- qteasy.built_in.PPO(par_values=(12, 26, 0))[source]
PPO (Percentage Price Oscillator) Trading Strategy: The PPO indicator represents the percentage difference between the fast and slow moving averages, which is used to determine the price trend. The period of calculation of the long and short averages and the type of average are parameters of the strategy.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
fp:int, fast averages calculate periodsp:int, slow SMA calculation periodm:int, moving average type (range 0-8)- Signal Type
Type PT: Percentage Position Target Signal
- Rules
Calculate the PPO according to the rules and generate position target signals based on the value of the PPO:.
1, When PPO > 0, set the position target to 1
2, When PPO < 0, set position target to -1
3, For the rest of the cases, set the position target to 0
- Default Values of Strategy Attributes
Default parameters:
(12, 26, 0)Data Type:
closeClosing price, single data inputWindow Length:
100Parameter range:
[(2, 100), (20, 200), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.RSI(par_values=(12, 70, 30))[source]
RSI (Relative Strength Index) Trading Strategy: The RSI measures the magnitude of recent price changes to determine whether a stock is currently oversold or overbought, and to determine the trend of change accordingly.The RSI always oscillates between 0 and 100, and is an oscillating curve.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, RSI calculated periodulim:int, triggers minimum for long positionsllim:int, triggers a ceiling on short positions- Signal Type
Type PT: Percentage Position Target Signal
- Rules
Calculate the RSI according to the rules and generate position target signals based on the value of the RSI in relation to ulim/llim:.
1, Set position target to 1 when RSI > ulim
2, When RSI < llim, set position target to -1
3, For the rest of the cases, set the position target to 0
- Default Values of Strategy Attributes
Default parameters:
(12, 70, 30)``Data Type:
closeClosing price, single data inputWindow Length:
100Parameter range:
[(2, 100), (50, 100), (0, 50)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.STOCH(par_values=(5, 3, 0, 3, 0))[source]
STOCH (Stochastic Indicator) Trading Strategy: The STOCH indicator measures the momentum of price changes and the size of the momentum determines the price trend and generates proportional buy and sell trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
fk:int, fast averages calculate periodsk:int, slow k-mean calculation periodskm:int, slow k-mean type, value range 0 to 8sd:int, slow d-mean calculated periodsdm:int, Slow D SMA type, value range 0 to 8- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate k-value and d-value according to the rules and generate proportional buy/sell trade signals based on the k-value:.
1, When k > 80, a gradual sell signal is generated to sell 30% of the holdings per cycle
2, When k < 20, a gradual buy signal is generated to buy 10% of the total investment per cycle
3, Signal is also generated when k and d diverge (future improvement)
- Default Values of Strategy Attributes
Default parameters:
(5, 3, 0, 3, 0)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow Length:
100Parameter range:
[(2, 100), (2, 100), (0, 8), (2, 100), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.STOCHF(par_values=(5, 3, 0))[source]
STOCHF (Stochastic Fast Indicator) Trading Strategy: The STOCHF indicator measures the momentum of a price change and, similar to the STOCH strategy, uses the Stochastic Fast Indicator to determine the price trend and generate proportional buy and sell trade signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
fk:int, fast K-mean calculation periodfd:int, fast D-mean calculated periodfdm:int, fast D average type, value range 0 to 8- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate k-value and d-value according to the rules and generate proportional buy/sell trade signals based on the k-value:.
1, When k > 80, a gradual sell signal is generated to sell 30% of the holdings per cycle
2, When k < 20, a gradual buy signal is generated to buy 10% of the total investment per cycle
3, Signal is also generated when k and d diverge (future improvement)
- Default Values of Strategy Attributes
Default parameters:
(5, 3, 0)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow Length:
100Parameter range:
[(2, 100), (2, 100), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.STOCHRSI(par_values=(14, 5, 3, 0))[source]
STOCHRSI (Stochastic Relative Strength Index) Trading Strategy: The STOCHRSI indicator measures the momentum of price changes, which fluctuates between 0 and 1, indicating the relative strength of the price trend and generates proportional buy and sell trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, calculation periodfk:int, fast K-mean calculation periodfd:int, fast D-mean calculated periodfdm:int, fast D average type, value range 0 to 8- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate k-value and d-value according to the rules and generate proportional buy/sell trade signals based on the k-value:.
1, When k > 0.8, a progressive sell signal is generated to sell 30% of holdings per cycle
2, When k < 0.2, a progressive buy signal is generated to buy 10% of the total investment per cycle
3, Signal is also generated when k and d diverge (future improvement)
- Default Values of Strategy Attributes
Default parameters:
(14, 5, 3, 0)Data Type:
closeClosing price, single data inputWindow Length:
100Parameter range:
[(2, 100), (2, 100), (2, 100), (2, 100), (0, 8)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.ULTOSC(par_values=(7, 14, 28, 70, 30))[source]
ULTOSC (Ultimate Oscillator Indicator) Trading Strategy: The ULTOSC indicator calculates price momentum over three different time horizons and generates trading signals based on deviations between the many different types of momentum.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p1:int, momentum calculation period 1p2:int, momentum calculation period 2p3:int, momentum calculation period 3u:int, sell signal thresholdsl:int, buy signal thresholds- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculation of the
ULTOSCindicator and generation of trading signals based on the size of the indicator.1, When
ULTOSC> u, a progressive sell signal is generated to sell 30% of holdings per cycle2, When ``ULTOSC `` < l, a progressive buy signal is generated to buy 10 per cent of the total investment per cycle.
- Default Values of Strategy Attributes
Default parameters:
(7, 14, 28, 70, 30)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow Length:
100Parameter range:
[(1, 100), (1, 100), (1, 100), (1, 100), (70, 99), (1, 30)]
Reference data is not supported, and trading data is not supported
Timing Strategy Based on Volume Technical Indicators
- qteasy.built_in.WILLR(par_values=(14, 80, 20))[source]
WILLR (William’s %R) Trading Strategy: The WILLR indicator is used to calculate whether a stock is currently in an overbought or oversold range and is used to generate trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
p:int, momentum calculation periodu:int, sell signal thresholdsl:int, buy signal thresholds- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculation of the
WILLRindicator and generation of trading signals based on the size of the indicator.1, When
WILLR > -l, a progressive sell signal is generated to sell 30% of holdings per cycle2, When
WILLR < -u, a progressive buy signal is generated to buy 10% of the total investment per cycle.- Default Values of Strategy Attributes
Default parameters:
(14, 80, 20)Data types:
high,low,closeHighest price, lowest price, closing price, multiple data inputsWindow Length:
100Parameter range:
[(2, 100), (70, 99), (1, 30)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.AD()[source]
AD Trading Strategy: This strategy uses the AD Line (Accumulate Distribution Line) to generate trading signals that are based on volume and price to determine the trend of cumulative inflows or outflows of money into or out of a stock, and to determine the upward/downward movement of the market through this trend.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
No policy parameters
- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculates the
ADindicator and generates trading signals based on changes in the AD signal (up/flat/down).The trend of the AD line is determined by comparing the size of the two AD values for today/yesterday:
1, Downtrend when
AD(last)'' > AD(latest), generating a gradual sell signal to sell 30% of holdings per cycle2, When
AD(last) < AD(latest), an uptrend, generating a gradual buy signal to buy 10% of the total amount invested per cycle.3, When
AD(last) = AD(latest), the trend is flat and no trading signals are generated- Default Values of Strategy Attributes
Default parameters:
()Data types:
high,low,close,volumeHighest price, lowest price, closing price, volume, multiple data inputsWindow Length:
100Parameter range:
[]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.ADOSC(par_values=(3, 10))[source]
AD Oscillator Trading Strategy: This strategy uses the ADOSC (Accumulate Distribution Oscillator) to generate trading signals. The AD Oscillator determines the direction of a stock’s price by calculating the MACD line of the AD line.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
f: int, fast averaging periods: int, slow averaging period- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculates the
ADOSCindicator and generates trading signals based on the size of the indicator.1, When
AD > 0, a progressive sell signal is generated to sell 30% of the holdings per cycle.2, When
AD < 0, a progressive buy signal is generated to buy 10% of the total amount invested per cycle.3, When
AD = 0, no trading signal is generated- Default Values of Strategy Attributes
Default parameters:
(3, 10)Data types:
high,low,close,volumeHighest price, lowest price, closing price, volume, multiple data inputsWindow Length:
100Parameter range:
[(2, 10), (10, 99)]
Reference data is not supported, and trading data is not supported
- qteasy.built_in.OBV(par_values=(15,))[source]
OBV Trading Strategy: This strategy uses OBV (On-Board Values) to generate trading signals, which are based on the volume and price of trades to identify changes in stocks.
Trend (determine the trend through the averages), when the OBV signal confirms the price uptrend, generating a signal to open a position, when the OBV signal and the price trend.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n: int, moving average of OBV and closing price to calculate period
- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate the
OBVindicator and calculate the N-day (N is an adjustable parameter) moving average of the OBV indicator, as well as the closing price of theN-Day Moving Averages and determine the up/down trend based on the relationship of the moving averages yesterday/today:.
A downtrend is judged when yesterday’s average is higher than today’s, and an uptrend is judged when yesterday’s average is lower than today’s.
The strategy then generates buy/sell signals based on confirmation/divergence of the up/down trend of the two averages:
1, When the closing price is trending up and the OBV is trending up, the uptrend is confirmed, buy 100% of the shares.
2, When the closing price is trending up but the OBV is trending down, an uptrend divergence, sell 50% of your holdings.
3, When the closing price trend is falling and the OBV trend is falling, the downtrend is confirmed and the entire holding is sold.
- Default Values of Strategy Attributes
Default parameters:
(15, )Data types:
close,volumeclosing price, volume, multiple inputsWindow Length:
100Parameter range:
[(5, 100)]
Reference data is not supported, and trading data is not supported
Timing Strategies Based on Volatility Technical Indicators
- qteasy.built_in.ATR(par_values=(15,))[source]
ATR Trading Strategy.
The ATR trading strategy uses the ATR indicator to generate trading signals. The ATR indicator measures the volatility of a stock’s price, and the volatility is used to determine the stock’s
risk and volatility to generate trading signals.
- Evaluation metrics for testing and evaluating the optimized strategy parameters.
n: int, the computation period of ATR
- Signal Type
Type PS: Percentage Buy/Sell Signal
- Rules
Calculate the
ATRindicator and calculate the N-day (N is an adjustable parameter) moving average of the price and the ATR indicator, andDetermine up/down trend based on ATR and moving average yesterday/today’s relationship.
A downtrend is judged when yesterday’s average is higher than today’s, and an uptrend is judged when yesterday’s average is lower than today’s.
The strategy is then based on the value of the ATR to determine whether the upward downward trend is confirmed or not:
1, When the closing price is trending up and the ATR is trending up, the uptrend is confirmed and 100% of the shares are bought.
2, When the closing price is trending down and the ATR is trending down, the downtrend is confirmed and all shares are sold.
3, No trading signals are generated when other conditions occur
- Default Values of Strategy Attributes
Default parameters:
(15, )Data types:
high,low,close, high, low, close, multiple data inputsWindow Length:
100Parameter range:
[(5, 100)]
Reference data is not supported, and trading data is not supported