關於鱷魚線

  •   2.7K 
  • 最後發表   帥哥元  2023 八月 04
帥哥元 發文於   2016/06/22

請問,我所查到的鱷魚線公式如下

中值 : (當日最高價+當日最低價)/2

 

顎線 :  13天每日中值平均值 (往右偏移8天)

 

齒線 :   8天每日中值平均值 (往右偏移5天)

 

唇線 :   5天每日中值平均值 (往右偏移3天)

 

 

所以,我寫出了下列公式,但是不知道(往右偏移?天),這段該怎麼寫?

因為,跑出來的線型與主圖內建的鱷魚線不同

 

 

variable:Jaws(0), Lips(0), Teeth(0);

 

 

settotalbar(300);

 

 

Jaws = Average(((high + low)/2), 13)[8];

 

 

Teeth = Average(((high + low)/2), 8)[5];

 

 

Lips = Average(((high + low)/2), 5)[3];

 

 

Plot1(Jaws, "顎");

 

 

Plot2(Teeth, "齒");

 

 

Plot3(Lips, "唇");

排序方式: 標準 | 最新
XQ小編 發文於   2016/06/23

您好:

 

鱷魚線定義 該連結網頁為,內建主圖的鱷魚線指標定義,

 

由於,XS腳本內沒有提供該鱷魚線的腳本程式碼,因此小編按照定義,嘗試寫出鱷魚線指標,

請您參考,對照後應該一致,謝謝。

 

variable:Jaws_Initial(0), Lips_Initial(0), Teeth_Initial(0), Jaws(0), Lips(0), Teeth(0); 


value1 = (high + low)/2;    //  中值


//  初始值顎、齒、唇第一筆
if  currentbar = 1 then
begin
    Jaws_Initial = value1;
    Teeth_Initial= value1;
    Lips_Initial = value1;
end;

//  顎初始值 第2筆 至 第13筆 的計算
if  currentbar > 1 and currentbar <= 13 then
begin
    Jaws_Initial = Jaws_Initial[1] + (value1 - Jaws_Initial[1]) / 13;
end;

//  齒初始值 第2筆 至 第8筆 的計算
if  currentbar > 1 and currentbar <= 8 then
begin
    Teeth_Initial = Teeth_Initial[1] + (value1 - Teeth_Initial[1]) / 8;
end;

//  唇初始值 第2筆 至 第5筆 的計算
if  currentbar > 1 and currentbar <= 5 then
begin
    Lips_Initial = Lips_Initial[1] + (value1 - Lips_Initial[1]) / 5;
end;



//  顎第一筆 取8天前的EMPt值作為當天的顎線值
if  currentbar = 21 then Jaws = Jaws_Initial;

//  齒第一筆 取5天前的EMPt值作為當天的齒線值
if  currentbar = 13 then Teeth = Teeth_Initial;

//  唇第一筆 取3天前的EMPt值作為當天的齒線值
if  currentbar = 8 then Lips = Lips_Initial;



//  顎
if  currentbar > 21 then Jaws = Jaws[1] + (value1[8] - Jaws[1]) / 13;

//  齒
if  currentbar > 13 then Teeth = Teeth[1] + (value1[5] - Teeth[1]) / 8;

//  唇
if  currentbar > 8 then Lips = Lips[1] + (value1[3] - Lips[1]) / 5;


plot1(Jaws);
plot2(Teeth);
plot3(Lips);


 

帥哥元 發文於   2016/06/23

出來了,萬分感謝!!

  • 按讚來自於
  • XQ
stone77 發文於   2023/07/29

碎型指標 ( fractal line indicator )}
Inputs:N(5);
//value1=swinghigh(1,high,Strength,89);
//value2=swinglow(1,low,Strength,89);
value1=swinghigh(H,N,2,2,1);
value2=swinglow(L,N,2,2,1);

請小編大大指正一下碎型指標

 

 

 

XQ小幫手 發文於   2023/08/04

Hello stone77,

 

小幫手推測您應該是參考了此網站的腳本。

需注意該網站是使用了TradeStation的語法,其 SwingHigh 和 XQ 的 SwingHigh 有所不同。

 

Inputs:Strength(2);

value1=swinghigh(1,high,Strength,89);

value2=swinglow(1,low,Strength,89);

 

if value1>-1 then plot1(value1,"BuyFractal");

if value2>-1 then plot2(value2,"SellFractal");

 

這段在XQ應該改為:

Inputs:Strength(2);

value1 = swinghigh(high, 89, Strength, Strength, 1);

value2 = swinglow(low, 89, Strength, Strength, 1);

 

if value1>-1 then plot1(value1,"BuyFractal");

if value2>-1 then plot2(value2,"SellFractal");

 

網站上有教學區,裡面有XS語法的基礎和應用可以閱覽。

發表回覆
Close