编写要求:
求帮各位老师,做个趋势买卖主图,出B点并且红绿2线方向朝上的选股指标,谢谢拉
VAR1:=(C+H+O+L)/4;
卖出:XMA(VAR1,N)*(1+P1/1000),COLORGREEN,LINETHICK2;
买入:XMA(VAR1,M)*(1-P2/1000),COLORMAGENTA,LINETHICK2;
幅度:100*(卖出-买入)/买入,NODRAW;
MA1:=MA(VAR1,3);
STICKLINE(卖出>LOW AND 卖出MIN(C,O) AND 卖出LOW AND 卖出LOW AND 买入MIN(C,O) AND 买入LOW AND 买入HIGH,OPEN,CLOSE,3,0),COLORMAGENTA;
STICKLINE(买入>HIGH,HIGH,LOW,0,0),COLORMAGENTA;
DRAWTEXT(CROSS(C,买入) OR (L<买入),LOW*0.95,'B'),COLORRED,LINETHICK2;
DRAWTEXT(CROSS(C,卖出) OR (H>卖出),HIGH*1.02,'S'),COLORGREEN;
机会来临:=REF(IF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04,30,0),1),COLORF00FF0,LINETHICK2;
RSV2:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K2:=REF(MA(RSV2,3),1)+(RSV2-REF(MA(RSV2,3),1))/3;
D2:=REF(MA(K2,3),1)+(K2-REF(MA(K2,3),1))/3;
J2:=3*K2-2*D2;
BB1:=EMA(J2,5);
BB2:=REF(BB1,1);
金叉:=CROSS(BB1,BB2);
DRAWTEXT(CROSS(C,买入) AND BB1>BB2 AND C>REF(O,2),买入*0.95,'买入'),COLOR0000FF;
DRAWICON(CROSS(C,买入) AND 金叉 AND 机会来临 ,LOW*0.96,26);
DRAWTEXT(CROSS(C,买入) AND 金叉 AND 机会来临,LOW*0.92,'【绝杀点--指标超市】'),COLOR00FF00;
解答:
?VAR1:=(C+H+O+L)/4;
买入:=XMA(VAR1,M)*(1-P2/1000);