您好:
請問有KDJ 及 MACD雙線 及 MACD柱狀 背離的語法範本嗎?
謝謝
你好:
請麻煩詳述你的策略內容喔,以利小幫手評估,或是你有相關程式碼的話,也可以附上,小幫手會嘗試幫忙除錯的,以上說明。
您好:
我想要KDJ 裡面 J 值跟價格的背離並在K線或指標上呈現
但是我將語法貼上後送出,出現 error creating post,所以我將語法寄至service@moneydj.com
能否能幫我看一下,謝謝
Hi yingwei,
收到您的Code如下,
//KDJ指標
//
input: Length(9), RSVt(3), Kt(3), JType(0);
variable: rsv(0), k(0), _d(0), j(0);
SetInputName(1, "天數");
SetInputName(2, "RSVt權數");
SetInputName(3, "Kt權數");
Stochastic(Length, RSVt, Kt, rsv, k, _d);
if JType = 0 then
j = 3 * k - 2 * _d
else
j = 3 * _d - 2 * k;
//背離
input: price(numericsimple),index1(numericsimple),length(numericsimple);
if length<5
then raiseruntimeerror("計算期別請超過五期");
value1=linearregslope(price,length);
value2=linearregslope(index1,length);
variable: deviate(0);
if value1>0 and value2<0
then deviate=-1
else
if value1<0 and value2>0
then deviate=1
else
deviate=0;
//J值背離
value1=J(0);
if deviate(close,value1,10)=1
then ret=1;
想請問您的程式碼第18行,
price、index1、length 輸入參數預設值各為多少?謝謝。
price(0)、index1(9)、length(60) 謝謝
Hi yingwei,
謝謝您提供相關資訊,
再請問一下,您的腳本類行為何?(指標、選股、警示) 謝謝。
小幫手猜想應該是指標腳本,不過還是確認一下,謝謝。
Hi 小幫手
沒錯,是指標腳本,感謝您
麻煩了 ,謝謝
謝謝小幫手:
因為直接套用無法使用(原本背離範例中RSI背離腳本好像也無法使用),我調整了一下,可以編譯完成,但仍然無法顯示出我要的圖示(如附圖),
再請您幫忙看一下是哪裡的問題,謝謝
J值背離:在高檔背離後J值下彎,在低檔背離後J值上彎,顯示:

//J值 input: Length(9), RSVt(3), Kt(3); variable: rsv(0), k(0), _d(0), j(0); SetInputName(1, "天數"); SetInputName(2, "RSVt權數"); SetInputName(3, "Kt權數"); Stochastic(Length, RSVt, Kt, rsv, k, _d); j= 3 * k - 2 * _d; plot1(J,"j值"); //J值背離 inputrice(0),index1(9),length_J(9); if length<5 then raiseruntimeerror("計算期別請超過五期"); value1=linearregslope(price,length); value2=linearregslope(index1,length); variable
eviate(0); if value1>0 and value2<0 then deviate=-1 else if value1<0 and value2>0 then deviate=1 else deviate=0; value3=J(9,3,3); value4=J(9,3,3); if deviate(high,value3,20)=-1 and J<J[1] then plot2(high,"高檔背離") ;//高檔背離後J值下彎 if deviate(low,value4,20)=1 and J>J[1] then plot3(low,"低檔背離") ;//低檔背離後J值上彎
Hi yingwei,
您附上腳本語法,有些程式碼,貌似不是XS的程式碼,
請您附上完整的程式碼腳本,或者Mail至客服信箱XQservice@XQ.com.tw,
以利小幫手查看問題的原因,以上,謝謝。
小幫手您好:
抱歉,複製貼上時格是跑掉我沒注意到,這次應該沒問題了,再麻煩您了,謝謝
//J值
input: Length(9), RSVt(3), Kt(3);
variable: rsv(0), k(0), _d(0), j(0);
SetInputName(1, "天數");
SetInputName(2, "RSVt權數");
SetInputName(3, "Kt權數");
Stochastic(Length, RSVt, Kt, rsv, k, _d);
j= 3 * k - 2 * _d;
plot1(J,"j值");
//J值背離
input:price(0),index1(9),length_J(9);
if length<5
then raiseruntimeerror("計算期別請超過五期");
value1=linearregslope(price,length);
value2=linearregslope(index1,length);
variable:deviate(0);
if value1>0 and value2<0
then deviate=-1
else
if value1<0 and value2>0
then deviate=1
else
deviate=0;
value3=J(9,3,3);
value4=J(9,3,3);
if deviate(high,value3,20)=-1 and J<J[1] then plot2(high,"高檔背離") ;//高檔背離後J值下彎
if deviate(low,value4,20)=1 and J>J[1] then plot3(low,"低檔背離") ;//低檔背離後J值上彎
11 評論