def under_cross(signal,source,follow): ''' 信号日低于或下叉。source一般为downlimit,follow为low 不仅仅给出下叉信号,而且还给出signal日follow是否低于source 信号日低于,则将屏蔽买入 下叉则是卖出 ''' sd = equals(cross(source,follow),-1) indices = (signal > 0) sd[indices] = greater_equals(source[indices],follow[indices]) return sd
def under_cross(signal, source, follow): ''' 信号日低于或下叉。source一般为downlimit,follow为low 不仅仅给出下叉信号,而且还给出signal日follow是否低于source 信号日低于,则将屏蔽买入 下叉则是卖出 ''' sd = equals(cross(source, follow), -1) indices = (signal > 0) sd[indices] = greater_equals(source[indices], follow[indices]) return sd
def closedayofweek(weekdays): #周收盘日 #特别特殊的情形下会不正确,如某周一交易日后,下一个交易日正好是下周二,则该周一不会被识别为周收盘日 #另,最后一个交易日也被识别为周收盘日 return greater(greater_equals(weekdays-rollx(weekdays,-1)) + equals(weekdays,5))
def closedayofweek(weekdays): #周收盘日 #特别特殊的情形下会不正确,如某周一交易日后,下一个交易日正好是下周二,则该周一不会被识别为周收盘日 #另,最后一个交易日也被识别为周收盘日 return greater( greater_equals(weekdays - rollx(weekdays, -1)) + equals(weekdays, 5))