Ö¸±ê²»ÊÇÍòÄܵģ¬±¾ÈËÀúÀ´ÈÏΪ³´¹ÉÖ®ÈË£¬ÔÚ¾ö¶¨ÈëÊÐ֮ǰ£¬±ØÐë׼ȷÑÐÅкÃÇ÷ÊÆ£¬ÔÚÄãÎÞ·¨È·¶¨Ç÷ÊƵÄÇé¿öÏ£¬×îºÃÔ¶Àë¹ÉÊУ¬¶øÖ¸±êÄܶÔÎÒÃÇÑÐÅÐÇ÷ÊÆÌṩºÜºÃµÄ°ïÖú£¬µ«Òª¼Çס£¬Ëü¾ø²»ÊǾÈÊÀÖ÷£¡
1¡¢¶«±±·¼Ïã°æÖ÷ËùÌáÖ®ÀíÄ¡¾½»Ò×֪ʶmacd.org.cnÊÕ¼¯ÕûÀí¡¿
ÓÃMACDÖ¸±ê¿ØÖƲÖλ
ÎÒÃÇÕâʱʹÓõÄÊÇMACDÖ¸±ê£¬Ö®ËùÒÔʹÓÃÕâ¸öÖ¸±êÊÇÒòΪËûÊÇÇ÷ÊÆÀàÖ¸±ê£¬ÔÚÇ÷ÊƵÄÑÐÅз½ÃæÓÐËûµÄÎȶ¨ÐÔ¡£²ÎÊýÓÃÖ¸±êµÄĬÈϲÎÊý¼´¿É¡£
01¡¡µ±DIF£¾0¡¡AND¡¡DIF£¾DEAʱ¡¡²Öλ¿ÉÔÚ2/3Ö®ÉÏ
02¡¡µ±DIF£¾0³öÏÖËÀ²æDEAʱ£¬²Öλ¼õ°ë ÈôÖ®ºó³öÏÖÔٴνð²æDEAͬʱ·ÅÁ¿£¬Ôò»Ø²¹²Öλ
03¡¡µ±DIF£¾0¡¡Í¬Ê±³öÏÖ¶¥±³ÀëµÄÇé¿öÏÂËÀ²æDEAʱ£¬Çå²Ö!²Öλ¼õ°ë ÈôÖ®ºó³öÏÖÔٴνð²æDEA£¬²»¹ÜÊÇ·ñ·ÅÁ¿£¬¼á¾ö²»»Ø²¹!
04¡¡µ±DIFËÀ²æ0Öáʱ£¬¼á¾öÇå²ÖÀ볡
µ±´óÅÌMACD¾ùΪµÚÒ»·NÇé¿öʱ£¬
05¡¡¸ö¹É³öÏÖµÚÒ»·NÇé¿öʱ£¬´óµ¨×ö¶à£¬¼Ó²ÖÒª¹û¶Ï
06¡¡¸ö¹É³öÏÖµÚ¶þ·Nʱ£¬ÊÊÁ¿¼õ²Ö£¬Ò»µ©³öÏÖÔٴνð²æDEA²¢Í¬Ê±·ÅÁ¿Ê±£¬¹û¶Ï»Ø²¹²Öλ
07¡¡¸ö¹É³öÏÖµÚÈý·NÇé¿öʱ£¬Çå²Ö£¡
08¡¡¸ö¹É³öÏÖµÚËÄ·NÇé¿öʱ£¬À볡£¡
µ±´óÅÌMACD³öÏÖµÚ¶þ·NÇé¿öʱ£¬
09¡¡¸ö¹É³öÏÖµÚÒ»·NÇé¿öʱ£¬²Öλ×î¸ßΪ1/2
10¡¡¸ö¹É³öÏÖµÚ¶þ¡¢Èý·NÇé¿öʱ£¬Çå²Ö£¬ÈôºóÆÚÔٴγöÏÖ½ð²æ£¬²»»Ø²¹£¡¡¾½»Ò×֪ʶmacd.org.cnÊÕ¼¯ÕûÀí¡¿
µ±´óÅ̳öÏÖµÚÈý·NÇé¿öʱ£¬µÚһʱ¼äÇå²Ö£¬¹ÛÍû¡£
11¡¡¸ö¹É³öÏÖµÚÒ»·NÇé¿öʱ£¬Òª¹Û²ìÁ¿¼Û¹Øϵ£¬ÈôΪÕý̬·Ö²¼£¬×î¸ß²ÖλΪ1/3
12¡¡¸ö¹É³öÏÖµÚ¶þ¡¢Èý·NÇé¿öʱ£¬Çå²Ö£¬ÈôºóÆÚÔٴγöÏÖ½ð²æ£¬²»»Ø²¹£¡
µ±´óÅ̳öÏÖµÚËÄ·NÇé¿öʱ£¬ÒÔ¹ÛÍûΪÉÏ
µ±´óÅÌMACDÔÚ0ÖáÖ®ÏÂß\ÐÐʱ
13¡¡¸ö¹É³öÏÖµÚÒ»·NÇé¿öʱ£¬Òª¹Û²ìÁ¿¼Û¹Øϵ£¬ÈôΪÕý̬·Ö²¼£¬×î¸ß²ÖλΪ1/4
14¡¡¸ö¹É³öÏÖµÚ¶þ¡¢Èý·NÇé¿öʱ£¬Çå²Ö£¬ÈôºóÆÚÔٴγöÏÖ½ð²æ£¬²»»Ø²¹£¡
µ±´óÅÌMACDÔÚ0Öá֮ϳöÏÖµ×±³Àëºó£¬DIF£¾DEA£¬Í¬Ê±£¬¸ö¹É±ä³öÏÖͬÑù×´¿ö£¬¿ÉÉÙÁ¿²ÎÓë¹ÉÐԽϻîµÄ¸ö¹É£¬·ç¸ñÉϱØÐëΪ¶ÌÏߣ¬¿ì½ø¿ì³ö¡£¡¾½»Ò×֪ʶmacd.org.cnÊÕ¼¯ÕûÀí¡¿
2¡¢°´´Ë±àдMACD_KCÖ¸±êÔÂ룺
²ÎÊýÉèÖãºLONG(26,1,100,1); SHORT(12,1,40,1); M(9,2,60,1)
variable:dpHBL=0;
variable:gHBL=0;
variable:dpLBL=0;
variable:gLBL=0;
dpDIF:=ema(INDEXC,short) - ema(INDEXC,long);
dpDEA:=ema(dpDIF,M);
dpMACD:=2*(dpDIF-dpDEA);
gDIF:=EMA(C,SHORT) - EMA(C,LONG);
gDEA:=EMA(gDIF,M);
gMACD:=2*(gDIF-gDEA);
DIFF:=if(CATEGORY=0 or CATEGORY=3, dpDIF, gDIF);
DEA:=if(CATEGORY=0 or CATEGORY=3, dpDEA, gDEA);
MACD:=if(CATEGORY=0 or CATEGORY=3, dpMACD, gMACD);
dpHDIF:=if(ref(dpDIF,2)<=ref(dpDIF,1) and dpDIF<ref(dpDIF,1),ref(dpDIF,1),0);
dpLDIF:=if(ref(dpDIF,2)>=ref(dpDIF,1) and dpDIF>ref(dpDIF,1),ref(dpDIF,1),0);
gHDIF:=if(ref(gDIF,2)<=ref(gDIF,1) and gDIF<ref(gDIF,1),ref(gDIF,1),0);
gLDIF:=if(ref(gDIF,2)>=ref(gDIF,1) and gDIF>ref(gDIF,1),ref(gDIF,1),0);
dpT:=if(BARSLAST(dpHDIF)=0,ref(BARSLAST(dpHDIF),1)+1,BARSLAST(dpHDIF));
dpT1:=if(BARSLAST(dpLDIF)=0,ref(BARSLAST(dpLDIF),1)+1,BARSLAST(dpLDIF));
gT:=if(BARSLAST(gHDIF)=0,ref(BARSLAST(gHDIF),1)+1,BARSLAST(gHDIF));
gT1:=if(BARSLAST(gLDIF)=0,ref(BARSLAST(gLDIF),1)+1,BARSLAST(gLDIF));
if ref(dpHBL,1)=1 then begin
if dpHDIF<>0 then begin
dpHBL:=if(dpHDIF<=ref(dpHDIF,dpT),0,1);{иß>Ç°¸ßΪ1,ÆäÓàΪ0}
end else begin
dpHBL:=ref(dpHBL,1);
end
end else begin
if dpHDIF<>0 then begin
dpHBL:=if(dpHDIF<=ref(dpHDIF,dpT),0,1);{иß>Ç°¸ßΪ1,ÆäÓàΪ0}
end else begin
dpHBL:=ref(dpHBL,1);
end
end
if ref(dpLBL,1)=1 then begin
if dpLDIF<>0 then begin
dpLBL:=if(dpLDIF>=ref(dpLDIF,dpT1),0,1);{еÍ<Ç°µÍΪ1,ÆäÓàΪ0}
end else begin
dpLBL:=ref(dpLBL,1);
end
end else begin
if dpLDIF<>0 then begin
dpLBL:=if(dpLDIF>=ref(dpLDIF,dpT1),0,1);{еÍ<Ç°µÍΪ1,ÆäÓàΪ0}
end else begin
dpLBL:=ref(dpLBL,1);
end
end
if ref(gHBL,1)=1 then begin
if gHDIF<>0 then begin
gHBL:=if(gHDIF<=ref(gHDIF,gT),0,1);{иß>Ç°¸ßΪ1,ÆäÓàΪ0}
end else begin
gHBL:=ref(gHBL,1);
end
end else begin
if gHDIF<>0 then begin
gHBL:=if(gHDIF<=ref(gHDIF,gT),0,1);{иß>Ç°¸ßΪ1,ÆäÓàΪ0}
end else begin
gHBL:=ref(gHBL,1);
end
end
if ref(gLBL,1)=1 then begin
if gLDIF<>0 then begin
gLBL:=if(gLDIF>=ref(gLDIF,gT1),0,1);{еÍ<Ç°µÍΪ1,ÆäÓàΪ0}
end else begin
gLBL:=ref(gLBL,1);
end
end else begin
if gLDIF<>0 then begin
gLBL:=if(gLDIF>=ref(gLDIF,gT1),0,1);{еÍ<Ç°µÍΪ1,ÆäÓàΪ0}
end else begin
gLBL:=ref(gLBL,1);
end
end
dpA1:=dpDIF>0 and dpDIF>dpDEA;
gA1:=gDIF>0 and gDIF>gDEA;
dpA2a:=dpDIF>0 and cross(dpDEA,dpDIF);
dpA2b:=dpDIF>0 and cross(dpDIF,dpDEA) and INDEXV>ref(hhv(INDEXV,3),1) and INDEXV>ma(INDEXV,5);
gA2a:=gDIF>0 and cross(gDEA,gDIF);
gA2b:=gDIF>0 and cross(gDIF,gDEA) and V>ref(hhv(v,3),1) and V>ma(v,5);
dpA3:=dpDIF>0 and dpHBL=0 and cross(dpDEA,dpDIF);
gA3:=gDIF>0 and gHBL=0 and cross(gDEA,gDIF);
dpA4:=cross(0,dpDIF);
gA4:=cross(0,gDIF);
if dpA1 then begin
cw:=if(gA1,4,if(gA2a,5,if(gA2b,6,if(gA3 or gA4,0,0))));
end
if dpA2a then begin
cw:=if(gA1,3,if(gA2a or gA3 or gA4,0,0));
end
if dpA3 then begin
cw:=if(gA1,if(C>ref(C,1) and V>ref(V,1),2,0),0);
end
if dpA4 then cw:=0;
if dpMACD>=0 and dpDIF<=0 then begin
cw:=if(gA1,if(C>ref(C,1) and V>ref(V,1),1,0),0);
end
DIFF:DIFF,linethick0;
DEA:DEA, coloryellow;
MACD:MACD,colorstick;
CW:cw,linethick0;
PARTLINE(DIFF,DIFF>ref(DIFF,1),rgb(255,0,0),DIFF<=ref(DIFF,1),rgb(0,0,255));
DRAWICON(cw<>ref(cw,1) and cw=0,DIFF,5),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=0,DIFF,' ¿Õ²Ö'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=1,DIFF,4),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=1,DIFF,' 1/4²Ö'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=2,DIFF,4),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=2,DIFF,' 1/3²Ö'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=3,DIFF,4),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=3,DIFF,' 1/2²Ö'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=4,DIFF,4),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=4,DIFF,' 2/3²Ö'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=5,DIFF,5),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=5,DIFF,' ¼õ°ë'),ALIGN1,VALIGN2;
DRAWICON(cw<>ref(cw,1) and cw=6,DIFF,4),ALIGN1,VALIGN1;
DRAWTEXT(cw<>ref(cw,1) and cw=6,DIFF,' ²¹²Ö'),ALIGN1,VALIGN2;