kiyi0317 發表於 17-11-5 14:50

想研究一下以下信號,請問有無高手可以幫手轉換成MC code

{庄家出现}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
J1:=REVERSE(J);
AA:=REF(MA(C,1),10)>REF(MA(C,60),10);
买点:CROSS(J,J1) AND AA;
STICKLINE(买点,0,30,6,0),COLORBLUE;
STICKLINE(买点,30,60,4,0),COLORWHITE;
STICKLINE(买点,60,80,2,0),COLORYELLOW;
DRAWTEXT(买点,70,'庄家出现'),COLORRED;
{主力进出场}
VAR1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
VAR2:=SMA(ABS(LOW-VAR1),13,1)/SMA(MAX(LOW-VAR1,0),10,1);
VAR3:=EMA(VAR2,10);
VAR4:=LLV(LOW,33);
VAR5:=EMA(IF(LOW<=VAR4,VAR3,0),3);
主力进场:IF(VAR5>REF(VAR5,1),VAR5,0),COLORRED,NODRAW;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,3,0 ),COLORRED;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,3,0 ),COLOR000055;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,2.6,0 ),COLOR000077;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,2.1,0 ),COLOR000099;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,1.5,0 ),COLOR0000BB;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,0.9,0 ),COLOR0000DD;
STICKLINE(VAR5>REF(VAR5,1),0,VAR5,0.3,0 ),COLOR0000FF;
洗盘:IF(VAR5<REF(VAR5,1),VAR5,0),COLORGREEN,NODRAW;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,3,0),COLORGREEN;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,3,0),COLOR005500;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,2.6,0),COLOR007700;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,2.1,0),COLOR009900;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,1.5,0),COLOR00BB00;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,0.9,0),COLOR00DD00;
STICKLINE(VAR5<REF(VAR5,1),0,VAR5,0.3,0),COLOR00FF00;
VAR12:=SMA(ABS(VAR1-H),13,1)/SMA(MAX(VAR1-H,0),10,1);
VAR13:=EMA(VAR12,10);
VAR14:=HHV(H,33);
VAR15:=EMA(IF(H>=VAR14,VAR13,0),3);
冲顶:IF(VAR15>REF(VAR15,1),VAR15,0),COLORFF00FF,NODRAW;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,3,0),COLORFF00FF;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,3,0 ),COLOR550055;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,2.6,0 ),COLOR770077;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,2.1,0 ),COLOR990099;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,1.5,0 ),COLORBB00BB;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,0.9,0 ),COLORDD00DD;
STICKLINE(VAR15>REF(VAR15,1),0,VAR15,0.3,0 ),COLORFF00FF;
主力出场:IF(VAR15<REF(VAR15,1),VAR15,0),COLORYELLOW,NODRAW;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,3,0 ),COLORYELLOW;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,3,0),COLOR005555;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,2.6,0),COLOR007777;
STICKLINE(VAR15<REF(VAR5,1),0,VAR15,2.1,0),COLOR009999;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,1.5,0),COLOR00BBBB;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,0.9,0),COLOR00DDDD;
STICKLINE(VAR15<REF(VAR15,1),0,VAR15,0.3,0),COLOR00FFFF;
A1:=REF(CLOSE,2);
A2:=SMA(MAX(CLOSE-A1,0),7,1)/SMA(ABS(CLOSE-A1),7,1)*100;
波段介入点:IF(A2<19,19,0)COLORWHITE;

easytrader788 發表於 17-11-9 20:59

程式碼的寫法本就是探底的方式,搭配KD指標的背離,較容易找到合適的點,甚或搭配兩次的背離來確認

easytrader788 發表於 17-11-8 17:17

沒改的話,只會畫一條等於1的線;VAR4會包含目前K棒的Low,所以VR5的判斷式恆為true,就沒意義了了

easytrader788 發表於 17-11-8 15:55

vars:VAR1(0),VAR2(0),VAR3(0),VAR4(0),VAR5(0),Mforce(false) ;
VAR1 = AvgPrice ;
if Average(MaxList((Low-VAR1),0),10) <>0 then
VAR2 = Average(AbsValue(Low-VAR1),13)/Average(MaxList((Low-VAR1),0),10) ;
VAR3 = XAverage(VAR2,10) ;
VAR4 = Lowest(Low,33) ;
VAR5 = xAverage(iff((Low < VAR4),VAR3,0),3) ;
Mforce = VAR5 > VAR5 ;

Plot1(iff(MForce,1,-1),"",iff(MForce,Red,Green),black,3) ;

easytrader788 發表於 17-11-8 15:58

先加上判斷分母不等於零,就可以避免浮點運算錯誤的信息

有一些進場的點位還不錯

easytrader788 發表於 17-11-8 08:47

上面 Mforce(0) 改Mforce(false)

Mforce = VAR5 > VAR5 ; //主力进场

easytrader788 發表於 17-11-8 08:39

*******{庄家出现}***********
vars: RSV(0),K(0),D(0),J(0),J1(0),AA(false),BuyCond(false) ;

變數 D 改成 DD ( D是保留字)

easytrader788 發表於 17-11-8 08:37

**********以下省略STICKLINE 畫柱體資料**********

洗盘:IF(VAR5<REF(VAR5,1),VAR5,0),COLORGREEN,NODRAW;
VAR12:=SMA(ABS(VAR1-H),13,1)/SMA(MAX(VAR1-H,0),10,1);
VAR13:=EMA(VAR12,10);
VAR14:=HHV(H,33);
VAR15:=EMA(IF(H>=VAR14,VAR13,0),3);
冲顶:IF(VAR15>REF(VAR15,1),VAR15,0),COLORFF00FF,NODRAW;
主力出场:IF(VAR15<REF(VAR15,1),VAR15,0),COLORYELLOW,NODRAW;
A1:=REF(CLOSE,2);
A2:=SMA(MAX(CLOSE-A1,0),7,1)/SMA(ABS(CLOSE-A1),7,1)*100;
波段介入点:IF(A2<19,19,0)COLORWHITE;

**************************************************
vars:VAR12(0),VAR13(0),VAR14(0),VAR15(0),CF(false) ,TrendTop(false), MForceOut(false),A1(0),A2(0),EntryBuy(false);
CF = VAR5 < VAR5 ;// 洗盤
VAR12 = Average(AbsValue(VAR1-High),13)/Average(MAxList(VAR1-High,0),10) ;
VAR13 = xAverage(VAR12,10) ;
VAR14 = Highest(High,33) ;
VAR15 = xAverage(iff(High >= VAR14,VAR13,0),3) ;
TrendTop = VAR15>VAR15 ; // 冲顶
MForceOut = VAR15<VAR15 ; // 主力出场
A1 = Close ;
A2 = Average(MAxList(Close-A1,0),7)/Average(AbsValue(Close-A1),7)*100 ;
EntryBuy = A2 < 19 ; // 波段介入点

easytrader788 發表於 17-11-8 07:44

這是利用KD指標作進出判斷的方式
http://www.ezchart.com.tw/inds.php?IND=KD

{庄家出现}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
J1:=REVERSE(J);
AA:=REF(MA(C,1),10)>REF(MA(C,60),10);
买点:CROSS(J,J1) AND AA;
*******{庄家出现}***********
vars: RSV(0),K(0),D(0),J(0),J1(0),AA(false),BuyCond(false) ;
RSV=(Close-Lowest(Low,9))/(Highest(High,9)-Lowest(Low,9))*100 ;
K = Average(RSV,3) ;
D = Average(K,3) ;
J = 3*K - 2*D ;
J1 = -J ;
AA = Average(Close,1) > Average(Close,60) ;
BuyCond = J cross over J1 and AA ;
****************************

easytrader788 發表於 17-11-8 07:56

STICKLINE(买点,0,30,6,0),COLORBLUE;
STICKLINE(买点,30,60,4,0),COLORWHITE;
STICKLINE(买点,60,80,2,0),COLORYELLOW;
DRAWTEXT(买点,70,'庄家出现'),COLORRED;

*******自行繪製指標及文字**********
STICKLINE 畫柱狀圖 ( 0~30區間,寬度6,空心柱體0),藍色;
STICKLINE 畫柱狀圖 ( 30~60區間,寬度4,空心柱體0),白色;
STICKLINE 畫柱狀圖 ( 60~80區間,寬度2,空心柱體0),黃色;
DRAWTEXT 標示文字 (70 的位置標示 '庄家出现') ;
**********************************

easytrader788 發表於 17-11-8 08:10

{主力进出场}
VAR1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
VAR2:=SMA(ABS(LOW-VAR1),13,1)/SMA(MAX(LOW-VAR1,0),10,1);
VAR3:=EMA(VAR2,10);
VAR4:=LLV(LOW,33);
VAR5:=EMA(IF(LOW<=VAR4,VAR3,0),3);
主力进场:IF(VAR5>REF(VAR5,1),VAR5,0),COLORRED,NODRAW;

**********主力进出场******************
vars:VAR1(0),VAR2(0),VAR3(0),VAR4(0),VAR5(0),Mforce(0) ;
VAR1 = AvgPrice ;
VAR2 = Average(AbsValue(Low-VAR1),13)/Average(MaxList((Low-VAR1),0),10) ;
VAR3 = XAverage(VAR2,10) ;
VAR4 = Lowest(Low,33) ;
VAR5 = xAverage(iff((Low <= VAR4),VAR3,0),3) ;
Mforce = iff(VAR5 > VAR5,VAR5,0) ;

kiyi0317 發表於 17-11-7 20:32

有無高人出手? 求教

kiyi0317 發表於 17-11-8 08:31

本帖最後由 kiyi0317 於 17-11-8 09:43 編輯

非常感謝easytrader大大出手相助,感謝萬分{:4_158:}

會努力學習,分析過後會回饋分析結果

kiyi0317 發表於 17-11-8 10:46

本帖最後由 kiyi0317 於 17-11-8 10:56 編輯

我把以下寫進去,complied之後放入圖表,但MC現error message,我也寫過類似的,並不知道那裹出問題,何解呢?
是否VAR2的混算問題?
附圖

vars:VAR1(0),VAR2(0),VAR3(0),VAR4(0),VAR5(0),Mforce(false) ;
VAR1 = AvgPrice ;
VAR2 = Average(AbsValue(Low-VAR1),13)/Average(MaxList((Low-VAR1),0),10) ;
VAR3 = XAverage(VAR2,10) ;
VAR4 = Lowest(Low,33) ;
VAR5 = xAverage(iff((Low <= VAR4),VAR3,0),3) ;
Mforce = VAR5 > VAR5 ;

if Mforce = True then plot1(1,"",default,default,3);




kiyi0317 發表於 17-11-8 16:55

easytrader兄,
為什麼要改這個VAR5?

kiyi0317 發表於 17-11-9 10:06

本帖最後由 kiyi0317 於 17-11-9 10:14 編輯

easytrader788 發表於 17-11-8 17:17
沒改的話,只會畫一條等於1的線;VAR4會包含目前K棒的Low,所以VR5的判斷式恆為true,就沒意義了了 ...
把chart setting轉做histogram就沒有問題,如改碼的話,發現還是有點不一樣的.


初步對此指標睇法是位置基本準確,但市場出現單向也有類似背馳現象,用來開倉就要注意風險,平倉止賺還是可以的.




頁: [1] 2
查看完整版本: 想研究一下以下信號,請問有無高手可以幫手轉換成MC code