通达信顶底判断副图 指标 源码
SHORT:=12;LONG:=26;MID:=9;DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);DEA:EMA(DIF,MID);MACD:(DIF-DEA)*2,COLORSTICK;
右红起N:=BARSLASTCOUNT(MACD>0),NODRAW;右红股高:=HHV(H,右红起N),NODRAW;左红股高:=REF(右红股高,BARSLAST(CROSS(0,MACD))+1),NODRAW;右红柱高:=HHV(MACD,右红起N),NODRAW;左红柱高:=REF(右红柱高,BARSLAST(CROSS(0,MACD))+1),NODRAW;HZDB:=MACD>0&&右红股高>左红股高&&右红柱高<左红柱高&&REF(BARSLASTCOUNT(MACD<0),右红起N)>=3,NODRAW;STICKLINE(REFX(HZDB&&MACD<REF(MACD,1),1)&&MACD>REF(MACD,1),0,MACD,2,0),COLORFF00FF;STICKLINE(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=1,0,MACD,2,0),COLORFF00FF;STICKLINE(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=2,0,MACD,2,0),COLORFF00FF;STICKLINE(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=3,0,MACD,2,0),COLORFF00FF;
DRAWNUMBER(REFX(HZDB&&MACD<REF(MACD,1),1)&&MACD>REF(MACD,1),MACD,0),DRAWABOVE;DRAWNUMBER(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=1,MACD,1),DRAWABOVE;DRAWNUMBER(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=2,MACD,2),DRAWABOVE;
DRAWTEXT(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=3&&EVERY(HZDB,3),0,'变'),COLORGREEN;DRAWTEXT(HZDB&&MACD<REF(MACD,1)&&BARSLASTCOUNT(MACD<REF(MACD,1))=3&&EVERY(HZDB,3),MACD,'③'),DRAWABOVE,COLORGREEN;
VAR1:=MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20;VAR2:=2*ABS(VAR1);VAR3:=100-(100-3*SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,20,1)+2*SMA(SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,20,1),15,1));VAR4:=100-(100-3*SMA((OPEN-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,20,1)+2*SMA(SMA((OPEN-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,20,1),15,1));VAR5:=(HIGH+LOW+CLOSE)/3;VAR6:=(VAR5-MA(VAR5,10))/(0.015*AVEDEV(VAR5,10));VAR7:=(VAR5-MA(VAR5,30))/(0.015*AVEDEV(VAR5,30));VAR8:=IF(VAR6>=150 AND VAR6<200 AND VAR7>=150 AND VAR7<200,10,0);VAR9:=IF(VAR6<=-150 AND VAR6>-200 AND VAR7<=-150 AND VAR7>-200,-10,VAR8);VARA:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;VARB:=100-ABS(VARA);
右绿起N:=BARSLASTCOUNT(MACD<0),NODRAW;右绿股低:=LLV(L,右绿起N),NODRAW;左绿股低:=REF(右绿股低,BARSLAST(CROSS(MACD,0))+1),NODRAW;右绿柱低:=LLV(MACD,右绿起N),NODRAW;左绿柱低:=REF(右绿柱低,BARSLAST(CROSS(MACD,0))+1),NODRAW;LZDB:=MACD<0&&右绿股低<左绿股低&&右绿柱低>左绿柱低&&REF(BARSLASTCOUNT(MACD>0),右绿起N)>=3;
STICKLINE(REFX(LZDB&&MACD>REF(MACD,1),1)&&MACD<REF(MACD,1),0,MACD,2,0),COLORGREEN;STICKLINE(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=1,0,MACD,2,0),COLORGREEN;STICKLINE(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=2,0,MACD,2,0),COLORGREEN;STICKLINE(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=3,0,MACD,2,0),COLORGREEN;
DRAWNUMBER(REFX(LZDB&&MACD>REF(MACD,1),1)&&MACD<REF(MACD,1),MACD,0);DRAWNUMBER(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=1,MACD,1);DRAWNUMBER(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=2,MACD,2);
DRAWTEXT(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=3&&EVERY(LZDB,3),0,'变'),COLORRED;DRAWTEXT(LZDB&&MACD>REF(MACD,1)&&BARSLASTCOUNT(MACD>REF(MACD,1))=3&&EVERY(LZDB,3),MACD,'③'),COLORRED;
未来函数检测结果如下:
该公式包含未来函数:REFX
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
SHORT赋值:12
LONG赋值:26
MID赋值:9
输出DIF:收盘价的SHORT日指数移动平均-收盘价的LONG日指数移动平均
输出DEA:DIF的MID日指数移动平均
输出MACD:(DIF-DEA)*2,COLORSTICK
右红起N赋值:BARSLASTCOUNT(MACD>0),NODRAW
右红股高赋值:右红起N日内H最高值,NODRAW
左红股高赋值:REF(右红股高,上次0上穿MACD距今天数+1),NODRAW
右红柱高赋值:右红起N日内MACD最高值,NODRAW
左红柱高赋值:REF(右红柱高,上次0上穿MACD距今天数+1),NODRAW
HZDB赋值:MACD>0&&右红股高>左红股高&&右红柱高<左红柱高&&REF(BARSLASTCOUNT(MACD<0),右红起N)>=3,NODRAW
STICKLINE(REFX(HZDB&&MACD<1日前的MACD,1)&&MACD>1日前的MACD,0,MACD,2,0),COLORFF00FF
STICKLINE(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=1,0,MACD,2,0),COLORFF00FF
STICKLINE(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=2,0,MACD,2,0),COLORFF00FF
STICKLINE(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=3,0,MACD,2,0),COLORFF00FF
DRAWNUMBER(REFX(HZDB&&MACD<1日前的MACD,1)&&MACD>1日前的MACD,MACD,0),DRAWABOVE
DRAWNUMBER(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=1,MACD,1),DRAWABOVE
DRAWNUMBER(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=2,MACD,2),DRAWABOVE
DRAWTEXT(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=3&&HZDB最近3日一直存在,0,'变'),画绿色
DRAWTEXT(HZDB&&MACD<1日前的MACD&&BARSLASTCOUNT(MACD<1日前的MACD)=3&&HZDB最近3日一直存在,MACD,'③'),DRAWABOVE,画绿色
VAR1赋值:MA(100*(收盘价-34日内收盘价最低值)/(34日内最高价最高值-34日内最低价最低值),5)-20
VAR2赋值:2*VAR1的绝对值
VAR3赋值:100-(100-3*SMA((收盘价-55日内最低价最低值)/(55日内最高价最高值-55日内最低价最低值)*100,20,1)+2*SMA(SMA((收盘价-55日内最低价最低值)/(55日内最高价最高值-55日内最低价最低值)*100,20,1),15,1))
VAR4赋值:100-(100-3*SMA((开盘价-55日内最低价最低值)/(55日内最高价最高值-55日内最低价最低值)*100,20,1)+2*SMA(SMA((开盘价-55日内最低价最低值)/(55日内最高价最高值-55日内最低价最低值)*100,20,1),15,1))
VAR5赋值:(最高价+最低价+收盘价)/3
VAR6赋值:(VAR5-VAR5的10日简单移动平均)/(0.015*AVEDEV(VAR5,10))
VAR7赋值:(VAR5-VAR5的30日简单移动平均)/(0.015*AVEDEV(VAR5,30))
如果VAR6>=150 AND VAR6<200 AND VAR7>=150 AND VAR7<200返回10否则返回0
如果VAR6<=-150 AND VAR6>-200 AND VAR7<=-150 AND VAR7>-200返回-10否则返回VAR8
VARA赋值:(收盘价-收盘价的13日简单移动平均)/收盘价的13日简单移动平均*100
VARB赋值:100-VARA的绝对值
右绿起N赋值:BARSLASTCOUNT(MACD<0),NODRAW
右绿股低赋值:右绿起N日内L最低值,NODRAW
左绿股低赋值:REF(右绿股低,上次MACD上穿0距今天数+1),NODRAW
右绿柱低赋值:右绿起N日内MACD最低值,NODRAW
左绿柱低赋值:REF(右绿柱低,上次MACD上穿0距今天数+1),NODRAW
LZDB赋值:MACD<0&&右绿股低<左绿股低&&右绿柱低>左绿柱低&&REF(BARSLASTCOUNT(MACD>0),右绿起N)>=3
STICKLINE(REFX(LZDB&&MACD>1日前的MACD,1)&&MACD<1日前的MACD,0,MACD,2,0),画绿色
STICKLINE(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=1,0,MACD,2,0),画绿色
STICKLINE(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=2,0,MACD,2,0),画绿色
STICKLINE(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=3,0,MACD,2,0),画绿色
DRAWNUMBER(REFX(LZDB&&MACD>1日前的MACD,1)&&MACD<1日前的MACD,MACD,0)
DRAWNUMBER(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=1,MACD,1)
DRAWNUMBER(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=2,MACD,2)
DRAWTEXT(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=3&&LZDB最近3日一直存在,0,'变'),画红色
DRAWTEXT(LZDB&&MACD>1日前的MACD&&BARSLASTCOUNT(MACD>1日前的MACD)=3&&LZDB最近3日一直存在,MACD,'③'),画红色