# 基于Alpha101语法开发的增强分析工具

Author: Hukybo, Created: 2020-04-03 16:33:02, Updated: 2020-04-10 13:47:05

#### 二、什么是 Alpha101

• 交易策略超额收益 = 被动(Beta)收益 + 交易(Alpha)收益。

#### 三、Alpha101 中有哪些因子

• 价格类因子：计算公式只用到价格，包括：开盘价、最高价、最低价、收盘价等等，输出为具体的数值。
• 量价类因子：计算公式使用了成交量和价格，其设计思路是判断价格变化和成交量变化之间的关系，输出为具体的数值。
• 二分类因子：计算公式使用了成交量和价格，与量价类因子一样，只是输出为 0 或 1。

Alpha#1 (rank(ts*argmax(signedpower(((returns < 0) ? stddev(returns, 20) : close), 2.), 5)) - 0.5) 趋势
Alpha#4 (-1 * ts_rank(rank(low), 9)) 反转
Alpha#5 (rank((open - (sum(vwap, 10) / 10))) * (-1 _ abs(rank((close - vwap))))) 反转
Alpha#8 (-1 _ rank(((sum(open, 5) _ sum(returns, 5)) - delay((sum(open, 5) * sum(returns, 5)), 10)))) 反转
Alpha#9 ((0 < ts*min(delta(close, 1), 5)) ? delta(close, 1) : ((ts_max(delta(close, 1), 5) < 0) ? delta(close, 1) : (-1 * delta(close, 1)))) 反转或趋势
Alpha#18 (-1 * rank(((stddev(abs((close - open)), 5) + (close - open)) + correlation(close, open, 10)))) 反转
Alpha#19 ((-1 * sign(((close - delay(close, 7)) + delta(close, 7)))) _ (1 + rank((1 + sum(returns, 250))))) 趋势背离
Alpha#20 (((-1 * rank((open - delay(high, 1)))) _ rank((open - delay(close, 1)))) * rank((open - delay(low, 1)))) 反转
Alpha#23 (((sum(high, 20) / 20) < high) ? (-1 * delta(high, 2)) : 0) 20 周期均线上的短期回归
Alpha#24 ((((delta((sum(close, 100) / 100), 100) / delay(close, 100)) < 0.05) 或 ((delta((sum(close, 100) / 100), 100) / delay(close, 100)) == 0.05)) ? (-1 _ (close - ts_min(close, 100))) : (-1 _ delta(close, 3))) 反转
Alpha#29 (min(product(rank(rank(scale(log(sum(tsmin(rank(rank((-1 * rank(delta((close - 1), 5))))), 2), 1))))), 1), 5) + tsrank(delay((-1 * returns), 6), 5)) 反转
Alpha#32 (scale(((sum(close, 7) / 7) - close)) + (20 * scale(correlation(vwap, delay(close, 5), 230)))) 反转
Alpha#33 rank((-1 * ((1 - (open / close))^1))) 反转
Alpha#34 rank(((1 - rank((stddev(returns, 2) / stddev(returns, 5)))) + (1 - rank(delta(close, 1))))) 反转
Alpha#37 (rank(correlation(delay((open - close), 1), close, 200)) + rank((open - close))) 统计
Alpha#38 ((-1 _ rank(ts_rank(close, 10))) _ rank((close / open))) 反转
Alpha#41 (((high * low)^0.5) - vwap) 反转
Alpha#42 (rank((vwap - close)) / rank((vwap + close))) 反转
Alpha#46 ((0.25 < (((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10))) ? (-1 _ 1) : (((((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10)) < 0) ? 1 : ((-1 _ 1) * (close - delay(close, 1))))) 反转
Alpha#48 未实现 未实现
Alpha#49 (((((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10)) < (-1 _ 0.1)) ? 1 : ((-1 _ 1) * (close - delay(close, 1)))) 反转
Alpha#51 (((((delay(close, 20) - delay(close, 10)) / 10) - ((delay(close, 10) - close) / 10)) < (-1 _ 0.05)) ? 1 : ((-1 _ 1) * (close - delay(close, 1))))
Alpha#53 (-1 * delta((((close - low) - (high - close)) / (close - low)), 9)) 反转
Alpha#54 ((-1 _ ((low - close) _ (open^5))) / ((low - high) * (close^5))) 反转
Alpha#56 未实现 未实现
Alpha#57 (0 - (1 * ((close - vwap) / decay*linear(rank(ts_argmax(close, 30)), 2)))) 反转
Alpha#60 (0 - (1 * ((2 _ scale(rank(((((close - low) - (high - close)) / (high - low)) * volume)))) - scale(rank(ts*argmax(close, 10))))))
Alpha#66 ((rank(decay_linear(delta(vwap, 3.51013), 7.23052)) + ts_rank(decay_linear(((((low * 0.96633) + (low _ (1 - 0.96633))) - vwap) / (open - ((high + low) / 2))), 11.4157), 6.72611)) * -1) 反转
Alpha#73 (max(rank(decay*linear(delta(vwap, 4.72775), 2.91864)), ts_rank(decay_linear(((delta(((open * 0.147155) + (low _ (1 - 0.147155))), 2.03608) / ((open _ 0.147155) + (low _ (1 - 0.147155)))) _ -1), 3.33829), 16.7411)) _ -1) 反转
Alpha#84 signedpower(ts_rank((vwap - ts_max(vwap, 15.3217)), 20.7127), delta(close, 4.96796))
Alpha#101 ((close - open) / ((high - low) + .001)) 反转

Alpha#2 (-1 * correlation(rank(delta(log(volume), 2)), rank(((close - open) / open)), 6)) 量价背离
Alpha#3 (-1 * correlation(rank(open), rank(volume), 10)) 量价背离
Alpha#6 (-1 * correlation(open, volume, 10)) 量价背离
Alpha#7 ((adv20 < volume) ? ((-1 _ ts_rank(abs(delta(close, 7)), 60)) _ sign(delta(close, 7))) : (-1 * 1))
Alpha#11 ((rank(ts*max((vwap - close), 3)) + rank(ts_min((vwap - close), 3))) * rank(delta(volume, 3))) 反转缩量
Alpha#12 (sign(delta(volume, 1)) * (-1 _ delta(close, 1))) 量价背离
Alpha#13 (-1 * rank(covariance(rank(close), rank(volume), 5))) 量价背离
Alpha#14 ((-1 _ rank(delta(returns, 3))) _ correlation(open, volume, 10)) 量价背离
Alpha#15 (-1 * sum(rank(correlation(rank(high), rank(volume), 3)), 3)) 量价背离
Alpha#16 (-1 * rank(covariance(rank(high), rank(volume), 5))) 量价背离
Alpha#17 (((-1 _ rank(ts_rank(close, 10))) _ rank(delta(delta(close, 1), 1))) * rank(ts*rank((volume / adv20), 5))) 反转缩量
Alpha#22 (-1 * (delta(correlation(high, volume, 5), 5) _ rank(stddev(close, 20)))) 量价背离
Alpha#25 rank(((((-1 _ returns) _ adv20) _ vwap) _ (high - close)))
Alpha#26 (-1 * ts*max(correlation(ts_rank(volume, 5), ts_rank(high, 5), 5), 3)) 量价背离
Alpha#28 scale(((correlation(adv20, low, 5) + ((high + low) / 2)) - close)) 背离反转
Alpha#30 (((1.0 - rank(((sign((close - delay(close, 1))) + sign((delay(close, 1) - delay(close, 2)))) + sign((delay(close, 2) - delay(close, 3)))))) * sum(volume, 5)) / sum(volume, 20)) 反转
Alpha#31 ((rank(rank(rank(decay_linear((-1 * rank(rank(delta(close, 10)))), 10)))) + rank((-1 _ delta(close, 3)))) + sign(scale(correlation(adv20, low, 12)))) 量价背离反转
Alpha#35 ((tsrank(volume, 32) * (1 - tsrank(((close + high) - low), 16))) * (1 - ts*rank(returns, 32)))
Alpha#36 (((((2.21 * rank(correlation((close - open), delay(volume, 1), 15))) + (0.7 _ rank((open - close)))) + (0.73 _ rank(ts*rank(delay((-1 * returns), 6), 5)))) + rank(abs(correlation(vwap, adv20, 6)))) + (0.6 _ rank((((sum(close, 200) / 200) - open) _ (close - open))))) 趋势
Alpha#39 ((-1 _ rank((delta(close, 7) _ (1 - rank(decay*linear((volume / adv20), 9)))))) * (1 + rank(sum(returns, 250)))) 量价背离反转
Alpha#40 ((-1 * rank(stddev(high, 10))) _ correlation(high, volume, 10)) 量价背离
Alpha#43 (tsrank((volume / adv20), 20) * tsrank((-1 * delta(close, 7)), 8)) 反转背离
Alpha#44 (-1 * correlation(high, rank(volume), 5)) 量价背离
Alpha#45 (-1 _ ((rank((sum(delay(close, 5), 20) / 20)) _ correlation(close, volume, 2)) * rank(correlation(sum(close, 5), sum(close, 20), 2)))) 量价背离
Alpha#47 ((((rank((1 / close)) _ volume) / adv20) _ ((high * rank((high - close))) / (sum(high, 5) / 5))) - rank((vwap - delay(vwap, 5))))
Alpha#50 (-1 * ts*max(rank(correlation(rank(volume), rank(vwap), 5)), 5)) 量价背离
Alpha#52 ((((-1 * tsmin(low, 5)) + delay(ts_min(low, 5), 5)) * rank(((sum(returns, 240) - sum(returns, 20)) / 220))) * tsrank(volume, 5)) 量价背离
Alpha#55 (-1 * correlation(rank(((close - ts_min(low, 12)) / (ts_max(high, 12) - ts_min(low, 12)))), rank(volume), 6)) 量价背离
Alpha#58 未实现 未实现
Alpha#59 未实现 未实现
Alpha#63 未实现 未实现
Alpha#67 未实现 未实现
Alpha#69 未实现 未实现
Alpha#70 未实现 未实现
Alpha#71 max(ts_rank(decay_linear(correlation(ts_rank(close, 3.43976), ts_rank(adv180, 12.0647), 18.0175), 4.20501), 15.6948), ts_rank(decay_linear((rank(((low + open) - (vwap + vwap)))^2), 16.4662), 4.4388))
Alpha#72 (rank(decay_linear(correlation(((high + low) / 2), adv40, 8.93345), 10.1519)) / rank(decay_linear(correlation(ts_rank(vwap, 3.72469), ts_rank(volume, 18.5188), 6.86671), 2.95011)))
Alpha#76 未实现 未实现
Alpha#77 min(rank(decay_linear(((((high + low) / 2) + high) - (vwap + high)), 20.0451)), rank(decay_linear(correlation(((high + low) / 2), adv40, 3.1614), 5.64125)))
Alpha#78 (rank(correlation(sum(((low * 0.352233) + (vwap _ (1 - 0.352233))), 19.7428), sum(adv40, 19.7428), 6.83313))^rank(correlation(rank(vwap), rank(volume), 5.77492)))
Alpha#80 未实现 未实现
Alpha#82 未实现 未实现
Alpha#83 ((rank(delay(((high - low) / (sum(close, 5) / 5)), 2)) * rank(rank(volume))) / (((high - low) / (sum(close, 5) / 5)) / (vwap - close)))
Alpha#85 (rank(correlation(((high _ 0.876703) + (close _ (1 - 0.876703))), adv30, 9.61331))^rank(correlation(ts_rank(((high + low) / 2), 3.70596), ts_rank(volume, 10.1595), 7.11408)))
Alpha#87 未实现 未实现
Alpha#88 min(rank(decay_linear(((rank(open) + rank(low)) - (rank(high) + rank(close))), 8.06882)), ts_rank(decay_linear(correlation(ts_rank(close, 8.44728), ts_rank(adv60, 20.6966), 8.01266), 6.65053), 2.61957))
Alpha#89 未实现 未实现
Alpha#90 未实现 未实现
Alpha#91 未实现 未实现
Alpha#92 min(ts_rank(decay_linear(((((high + low) / 2) + close) < (low + open)), 14.7221), 18.8683), ts_rank(decay_linear(correlation(rank(low), rank(adv30), 7.58555), 6.94024), 6.80584))
Alpha#93 未实现 未实现
Alpha#94 ((rank((vwap - ts_min(vwap, 11.5783)))^ts_rank(correlation(ts_rank(vwap, 19.6462), ts_rank(adv60, 4.02992), 18.0926), 2.70756)) * -1)
Alpha#96 (max(ts_rank(decay_linear(correlation(rank(vwap), rank(volume), 3.83878), 4.16783), 8.38151), ts_rank(decay_linear(ts_argmax(correlation(ts_rank(close, 7.45404), ts_rank(adv60, 4.13242), 3.65459), 12.6556), 14.0365), 13.4143)) * -1)
Alpha#97 未实现 未实现
Alpha#98 (rank(decay_linear(correlation(vwap, sum(adv5, 26.4719), 4.58418), 7.18088)) - rank(decay_linear(ts_rank(ts_argmin(correlation(rank(open), rank(adv15), 20.8187), 8.62571), 6.95668), 8.07206)))
Alpha#100 未实现 未实现

Alpha#22 (-1 _ (delta(correlation(high, volume, 5), 5) _ rank(stddev(close, 20)))) 反转
Alpha#27 ((0.5 < rank((sum(correlation(rank(volume), rank(vwap), 6), 2) / 2.0))) ? (-1 * 1) : 1) 量价背离
Alpha#61 (rank((vwap - ts*min(vwap, 16.1219))) < rank(correlation(vwap, adv180, 17.9282))) 量价背离
Alpha#62 ((rank(correlation(vwap, sum(adv20, 22.4101), 9.91009)) < rank(((rank(open) + rank(open)) < (rank(((high + low) / 2)) + rank(high))))) * -1)
Alpha#64 ((rank(correlation(sum(((open * 0.178404) + (low _ (1 - 0.178404))), 12.7054), sum(adv120, 12.7054), 16.6208)) < rank(delta(((((high + low) / 2) _ 0.178404) + (vwap _ (1 - 0.178404))), 3.69741))) * -1)
Alpha#65 ((rank(correlation(((open _ 0.00817205) + (vwap _ (1 - 0.00817205))), sum(adv60, 8.6911), 6.40374)) < rank((open - ts*min(open, 13.635)))) * -1)
Alpha#68 ((ts_rank(correlation(rank(high), rank(adv15), 8.91644), 13.9333) < rank(delta(((close * 0.518371) + (low _ (1 - 0.518371))), 1.06157))) * -1)
Alpha#74 ((rank(correlation(close, sum(adv30, 37.4843), 15.1365)) < rank(correlation(rank(((high _ 0.0261661) + (vwap _ (1 - 0.0261661)))), rank(volume), 11.4791))) * -1)
Alpha#75 (rank(correlation(vwap, volume, 4.24304)) < rank(correlation(rank(low), rank(adv50), 12.4413))) 量价关系
Alpha#79 未实现 未实现
Alpha#81 ((rank(log(product(rank((rank(correlation(vwap, sum(adv10, 49.6054), 8.47743))^4)), 14.9655))) < rank(correlation(rank(vwap), rank(volume), 5.07914))) * -1)
Alpha#86 ((ts_rank(correlation(close, sum(adv20, 14.7444), 6.00049), 20.4195) < rank(((open + close) - (vwap + open)))) * -1)
Alpha#95 (rank((open - ts_min(open, 12.4105))) < ts_rank((rank(correlation(sum(((high + low) / 2), 19.1351), sum(adv40, 19.1351), 12.8742))^5), 11.7584))
Alpha#99 ((rank(correlation(sum(((high + low) / 2), 19.8975), sum(adv60, 19.8975), 8.8136)) < rank(correlation(low, volume, 6.28259))) * -1)

#### 五、需要注意的地方

1、因子公式里面的参数均为默认，并非是最优参数，交易者可以根据品种、周期，以及自己的经验，选择比较合适的参数。 2、因子是相互独立的，把多个因子相互叠加起来，并不一定能得到更好的效果。在设计量化交易策略时，至少有自己的逻辑，而不是机械的拼凑。 3、因子是无限，Alpha101 只是一个抛砖引玉，相信大家能从中获得启发，创造出更多更好的因子和量化交易策略。

Related

More