自编公式

1. 一年新高:

// 创下新高
isReachHigh := HIGH >= HHV(HIGH, 250);

// 均线多头排列
isMaSorted := CLOSE > MA(CLOSE, 20)
AND MA(CLOSE, 20) > MA(CLOSE, 120)
AND MA(CLOSE, 120) > MA(CLOSE, 250);

// 大阳
isStrongK := CLOSE / REF(CLOSE,1) >= 1.05;

// 排除上影线
isCloseStrong := (HIGH - CLOSE) / REF(CLOSE,1) <= 0.02;

// 排除新股
notNew := TOTALBARSCOUNT > 120;

// 排除ST
notST := !NAMELIKE('ST') AND !NAMELIKE('*ST');

// 排除停牌
notStop := DYNAINFO(4) > 0;

RET:isReachHigh
AND isMaSorted
AND isStrongK
AND isCloseStrong
AND notNew
AND notST
AND notStop;

 

2. 旗形:

// 排除新股
notNew := TOTALBARSCOUNT > 250;

// 排除ST
notST := !NAMELIKE('ST') AND !NAMELIKE('*ST');

// 排除停牌
notStop := DYNAINFO(4) > 0;

// 股价应处于20日移动平均线上方
upMa := LOW >= MA(CLOSE, 20);

// 最近20日是否创下新高
daysCount := 250 * 3;
isHigh := HHV(HIGH, 20) >= HHV(HIGH, daysCount);

// 是否形成攻击性平台
// 至少4天内,股价在10个点之内振荡
waitDay := 4;                // 最少振荡天数
waitSize := 0.1;            // 最大振荡幅度
highPrice := MAX(HHV(OPEN, waitDay),HHV(CLOSE, waitDay));
lowPrice := MIN(LLV(OPEN, waitDay),LLV(CLOSE, waitDay));
priceSize := (highPrice - lowPrice) / lowPrice;
isWaiting := priceSize <= waitSize;

// 旗形最低价格不低于最近最高价10个点
// 排除冲高后急速回落形成的旗形
yearHighPrice := MAX(HHV(OPEN, daysCount),HHV(CLOSE, daysCount));
priceNotTooLow := (yearHighPrice - lowPrice) / yearHighPrice <= waitSize;

// 旗形最低收盘价高于20天前的新高价格
// 旗形应形成于新高位置
lastHighPrice := FINDHIGH(CLOSE, 20, daysCount - 20, 1);
lowClosePrice := LLV(CLOSE, waitDay);
upLastHigh := lowClosePrice >= lastHighPrice;

ok := notNew            // 排除新股
AND notST            // 排除ST
AND notStop            // 排除停牌
AND upMa            // 20日均线上方
AND isHigh            // 最近创下过一年新高
AND isWaiting            // 形成攻击性平台
AND priceNotTooLow        // 排除急速回落形成的旗形
AND upLastHigh;            // 旗形形成于新高位置

RET:ok;

3.不合要求:

isLowMa := CLOSE < MA(CLOSE, 20);                // 股价低于20日均线
isLowEight := REF(CLOSE,1) / CLOSE >= 100 / 92;            // 跌幅超过8个点

// 均线多头排列
isNotMaIncSort := MA(CLOSE, 20) <= MA(CLOSE, 50)
OR MA(CLOSE, 50) <= MA(CLOSE, 120)
OR MA(CLOSE, 120) <= MA(CLOSE, 250);

Ret : isLowMa OR isLowEight OR isNotMaIncSort;

 4.最近大涨

notNew := TOTALBARSCOUNT > 250;                    // 排除新股
notST := !NAMELIKE('ST') AND !NAMELIKE('*ST');            // 排除ST
notStop := DYNAINFO(4) > 0;                    // 排除停牌
isRiseMuch := CLOSE / REF(CLOSE, 60) > 1.5;
isHighRecently := HHV(CLOSE, 20) >= FINDHIGH(CLOSE, 20, 230, 1);

RET: notNew AND notST AND notStop AND isRiseMuch AND isHighRecently;

 

转载请注明出处:https://www.cnblogs.com/jietian331/p/12701457.html

posted @ 2020-04-14 21:51  孤独の巡礼  阅读(804)  评论(0编辑  收藏  举报