趋势用,周线可做参考,适合慢悠悠的投资者。
源码:
// 均线计算,判断上行趋势
主升浪:120,coloryellow;
AMH:=MA(CLOSE,PH);//均线龙头值
AMS:=MA(CLOSE,10);
AH1:=REF(AMH,0);
AH2:=REF(AMH,1);
AM1:=REF(AMS,0);
AM2:=REF(AMS,1);
BUY3:=(AH1-AH2)/AH2;// 均线速度
BUY31:=REF(BUY3,1);
BUY4:=(AM1-AM2)/AM2;
// // // // // KDJ
LOWV:=LLV(LOW,PM);
HIGHV:=HHV(HIGH,PM);
PN:=3;
RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,PN);
K:EMA(RSV,PN),colorwhite,LINETHICK2;
D:MA(K,PN),colorgray,LINETHICK1;
AK1:=REF(K,PD);
AK2:=REF(K,PD+1);
AK3:=REF(K,PD+2);
//tj:"jxm30.tj"()#minute60;
//DPTJ:INDEXDATA("1A0001",&XGDPVM.tj)#day;
// 买入条件1:K指标趋势值
BUY1:((AK1-AK2)*2+50);
BUY11:=REF(BUY1,1);
BUY12:=REF(BUY1,2);
STICKLINE(BUY1>50,50,BUY1,2,0),colorred,Linethick1;// 结合在KD图形中的标志
STICKLINE(BUY1<50,BUY1,50,2,0),colorgreen,Linethick1;
// 准备撤退
DRAWICON(BUY1>50 AND BUY1<BUY11 AND BUY11>BUY12,BUY1,2);
// 准备进攻
DRAWICON(BUY1<50 AND BUY1>BUY11 AND BUY11<BUY12,BUY1,1);
// 均线计算,判断上行趋势
AMT:=MA(CLOSE,PT);
////////////////////////////////////////////// // // // // MACD.12 26 9
//AMK:=500;
//DIFF:=(EMA(CLOSE,4)-EMA(CLOSE,20))*AMK/CLOSE;
//DEA:=EMA(DIFF,8),colorred;
//MACD:=(DIFF-DEA);
//STICKLINE(MACD>=0,MACD,0,2,0),colorred;// MACD指标指示
//STICKLINE(MACD<0,MACD,0,2,0),colorgreen;
//STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),coloryellow;
//STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),colormagenta;
// // // // // 建仓指标
ASP:=100;
STICKLINE(BUY1>=50,ASP,ASP+10,2,0),colorred;// SKDJ 建仓信号
STICKLINE(BUY1<50,ASP,ASP+10,2,0),colorgreen;
STICKLINE(BUY3>=0,ASP+10,ASP+10+BUY3*1000,2,0),colorwhite;
STICKLINE(BUY3<0,ASP,ASP+BUY3*1000,2,0),colorblue;
HTIME:=HOUR;//
MTIME:=MINUTE;
BUYTIME:IF(AK1>AK2 AND HTIME==15,ASP+5,ASP),coloryellow,LINETHICK2;
SELLTIME:IF(AK1<AK2 AND AK2>AK3,ASP+5,ASP+10),coloryellow,LINETHICK2;
// 顶部和底部区域划分线
顶区域:TOP,colorgreen;
中轴线:50,colorred,LINETHICK2;
底区域:BOTTOM,coloryellow;