agoha / 我的图书馆 / 【飞狐】MACD股价推算

0 0

   

【飞狐】MACD股价推算

2015-09-08  agoha
 参数:j1 为(1000,-1000,2000)
DIF:(EMA(c,12)-EMA(c,26));
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
DEA1:=2/10*DIF+8/10*EMA(REF(DIF,1),9);
Tsmacd:=2*DIF-2*DEA1;
MACD1:=MACD;   MACD昨:=ref(Tsmacd,1);  Macdx:=if(j1=-999,macd1,if(j1=-1000,MACD昨,j1));
股价:=351/28*(10/16*macdx+ema(ref(dif,1),9)-11/13*EMA(REF(c,1),12)+25/27*EMA(REF(c,1),26));
DRAWTEXT(j1=-999 and Islastbar ,dif ,'设J=-999,所演即时股价;'+NUMTOSTR(股价,2)+'                               ' ),colorc0c0c0,ALIGN2;

本帖隐藏的内容

DRAWTEXT(j1=-1000 and Islastbar ,dif ,'设J=-1000,J线拐头股价;'+NUMTOSTR(股价,2)+'                                ' ),colorc0c0c0,ALIGN2;
DRAWTEXT(j1=Macdx and Islastbar ,dif ,'设J=自定义,J线达标临界股价;'+NUMTOSTR(股价,2)+'                          ' ),colorc0c0c0,ALIGN2;




山丘村长先生的公式:

黄线是金叉死叉反推价,白线是diff反推价,紫线是macd反推价。

各代码如下:

参数: short(12,1,100,1) long(26,1,100,1) M(9,1,100,1)

DIFF :=EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA  :=EMA(DIFF,M);
MACD :=2*(DIFF-DEA);
jcsc:=(M-1)/(M+1)*dea/(1-2/(m+1));{计算出金叉死叉时的Diff值}
dd:=(macd/2+(dea*(m-1)/(M+1)))/(1-2/(m+1));{计算出明日macd=macd时的Diff值}
xx:(diff*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算今日Diff=diff的对应股价}
js:(jcsc*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算金叉死叉的对应股价}
ddd:(dd*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算macd柱体变向时的对应股价}


{改山丘村长反向推算macd 便于看盘
macd参数长短自己改就是了}

input: short (12,1,20), long(26,1,60),M(9,1,30);
DIFF: EMA(CLOSE, short)-EMA(CLOSE, long ),color0066ff,LINETHICK1;
{partline(DIFF,DIFF>=ref(DIFF,1),rgb(255,0,0),DIFF<ref(DIFF,1),rgb(0,255,0)),linethick1;}
DEA:EMA(DIFF,M),COLOR00BB00,LINETHICK1;
MACD: (DIFF-DEA)*2,COLORSTICK;
{partline(DIFF,DIFF>=ref(DIFF,1),rgb(255,0,0),DIFF<ref(DIFF,1),rgb(0,255,0)),linethick2;
FILLRGN(DIFF,DEA,DIFF>DEA,rgb(255,0,0),DIFF<DEA,rgb(0,255,0)),linethick2;}
{中轴:0,LAYER0,Coloreeeeee,LINETHICK1;}
jcsc:=(M-1)/(M+1)*dea/(1-2/(m+1));{计算出金叉死叉时的Diff值}
dd:=(macd/2+(dea*(m-1)/(M+1)))/(1-2/(m+1));{计算出明日macd=macd时的Diff值}
xx:=(diff*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算今日Diff=diff的对应股价}
js:=(jcsc*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算金叉死叉的对应股价}
ddd:=(dd*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算macd柱体变向时的对应股价};

DRAWTEXTEX(c,3,0,400,'DIFF拐头股价:'+NUMTOSTR(xx,2)),ColorFFFFFF,LINETHICK3;
DRAWTEXTEX(c,175,0,0,'MACD柱体变向对应股价:'+NUMTOSTR(ddd,2)),Color00A5FF,LINETHICK3;
DRAWTEXTEX(c,410,0,800,'金叉死叉对应股价:'+NUMTOSTR(js,2)),COLOR00BB00,LINETHICK3;
{PARTLINE(DIFF,CROSS(DIFF,DEA) AND DIFF<-0.2,RGB(255,245,12)),CROSSDOT,LINETHICK5;
PARTLINE(DIFF,CROSS(DIFF,DEA) AND DIFF>0,RGB(252,24,212)),CROSSDOT,LINETHICK5;
PARTLINE(DIFF,CROSS(DIFF,DEA) AND DIFF>-0.2 AND DIFF<0,RGB(200,80,20)),CROSSDOT,LINETHICK7;
PARTLINE(DIFF,CROSS(DEA,DIFF) AND DIFF>0,RGB(125,245,252)),CIRCLEDOT,LINETHICK5;}




    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。如发现有害或侵权内容,请点击这里 或 拨打24小时举报电话:4000070609 与我们联系。

    猜你喜欢

    0条评论

    发表

    请遵守用户 评论公约

    类似文章
    喜欢该文的人也喜欢 更多