老師,請幫忙改個選股指標
作者:文華財經 來源:cxh99.com 發布時間:2023年05月03日
-
咨詢內容:
?老師好!請幫忙把這個雙MACD指標,改寫為選股指標。 條件是:MACD1的DIF1和DEA1從下往上穿越MACD2的DIF2和DEA2。選股!參數老師不用管,我自己設置。代碼如下:
DIFF1 : EMA(CLOSE,SHORT1) - EMA(CLOSE,LONG1);DEA1 : EMA(DIFF1,M1),LINETHICK1;2*(DIFF1-DEA1),COLORSTICK;MACD1:2*(DIFF1-DEA1),COLORSTICK;
STICKLINE(MACD1>0 AND MACD1>=REF(MACD1,1),0,MACD1,10,0),RGB(210,0,0);STICKLINE(MACD1<0 AND MACD1<REF(MACD1,1),0,MACD1,10,0),RGB(0,255,255);
DRAWCOLORLINE(DIFF1>REF(DIFF1,1),DIFF1,COLORRED,COLORGREEN);DRAWCOLORLINE(DEA1>REF(DEA1,1),DEA1,COLORRED,COLORGREEN);
DRAWICON(CROSSDOWN(DIFF1 ,DEA1 )&&MACD1<0,DIFF1 ,'CO148';CROSSDOWN(DIFF1,DEA1 )&&MACD1<0,SOUND('';DRAWICON(CROSS(DIFF1,DEA1 )&&MACD1>0,DIFF1 ,'CO149';CROSS(DIFF1,DEA1 )&&MACD1<0,SOUND('';
DIFF2 : EMA(CLOSE,SHORT2) - EMA(CLOSE,LONG2);DEA2 : EMA(DIFF2,M2),LINETHICK1;2*(DIFF2-DEA2),COLORSTICK;MACD2:2*(DIFF2-DEA2),COLORSTICK;
STICKLINE(MACD2>0 AND MACD2>=REF(MACD2,1),0,MACD2,10,0),RGB(210,0,0);STICKLINE(MACD2<0 AND MACD2<REF(MACD2,1),0,MACD2,10,0),RGB(0,255,255);
DRAWCOLORLINE(DIFF2>REF(DIFF2,1),DIFF2,COLORRED,COLORGREEN);DRAWCOLORLINE(DEA2>REF(DEA2,2),DEA2,COLORRED,COLORGREEN);
DRAWICON(CROSSDOWN(DIFF2 ,DEA2 )&&MACD2<0,DIFF2 ,'CO148';CROSSDOWN(DIFF2,DEA2 )&&MACD2<0,SOUND('';DRAWICON(CROSS(DIFF2,DEA2 )&&MACD2>0,DIFF2 ,'CO149';CROSS(DIFF2,DEA2 )&&MACD2<0,SOUND('';
?
?來源:程序化99
-
文華技術人員:
參考:
DIFF1 : EMA(CLOSE,SHORT1) - EMA(CLOSE,LONG1);
DEA1 : EMA(DIFF1,M1),LINETHICK1;
2*(DIFF1-DEA1),COLORSTICK;
MACD1:2*(DIFF1-DEA1),COLORSTICK;
STICKLINE(MACD1>0 AND MACD1>=REF(MACD1,1),0,MACD1,10,0),RGB(210,0,0);
STICKLINE(MACD1<0 AND MACD1<REF(MACD1,1),0,MACD1,10,0),RGB(0,255,255);
DRAWCOLORLINE(DIFF1>REF(DIFF1,1),DIFF1,COLORRED,COLORGREEN);
DRAWCOLORLINE(DEA1>REF(DEA1,1),DEA1,COLORRED,COLORGREEN);
DRAWICON(CROSSDOWN(DIFF1 ,DEA1 )&&MACD1<0,DIFF1 ,'ICO148');
CROSSDOWN(DIFF1,DEA1 )&&MACD1<0,SOUND('A');
DRAWICON(CROSS(DIFF1,DEA1 )&&MACD1>0,DIFF1 ,'ICO149');
CROSS(DIFF1,DEA1 )&&MACD1<0,SOUND('B');
DIFF2 : EMA(CLOSE,SHORT2) - EMA(CLOSE,LONG2);
DEA2 : EMA(DIFF2,M2),LINETHICK1;
2*(DIFF2-DEA2),COLORSTICK;
MACD2:2*(DIFF2-DEA2),COLORSTICK;
STICKLINE(MACD2>0 AND MACD2>=REF(MACD2,1),0,MACD2,10,0),RGB(210,0,0);
STICKLINE(MACD2<0 AND MACD2<REF(MACD2,1),0,MACD2,10,0),RGB(0,255,255);
DRAWCOLORLINE(DIFF2>REF(DIFF2,1),DIFF2,COLORRED,COLORGREEN),LINETHICK2;
DRAWCOLORLINE(DEA2>REF(DEA2,2),DEA2,COLORRED,COLORGREEN),LINETHICK2;
DRAWICON(CROSSDOWN(DIFF2 ,DEA2 )&&MACD2<0,DIFF2 ,'ICO148');
CROSSDOWN(DIFF2,DEA2 )&&MACD2<0,SOUND('A');
DRAWICON(CROSS(DIFF2,DEA2 )&&MACD2>0,DIFF2 ,'ICO149');
CROSS(DIFF2,DEA2 )&&MACD2<0,SOUND('B');
AAX:=EXIST(MAX(DIFF1,DEA1)<MIN(DIFF2,DEA2),SUMBARS(MIN(DIFF1,DEA1)>MAX(DIFF2,DEA2),2));
CROSS(MIN(DIFF1,DEA1),MAX(DIFF2,DEA2))&&AAX,SELECT;
DRAWICON(CROSS(MIN(DIFF1,DEA1),MAX(DIFF2,DEA2))&&AAX,MACD1,1);