跨頻率指標不能用,有的股票可正常顯示,有的股票不行

  •   132 
  • 最後發表   topenga0501  2020 十二月 17
topenga0501 發文於   2020/12/15

// 跨頻率DMI指標

 // 不支援大頻率跨小頻率,例如:

 // 不支援主頻率週資料,跨頻率計算日DMI技術指標。

 //

 if barfreq <> "Tick" and barfreq <> "Min" and barfreq <> "D" and barfreq <> "W" and barfreq <> "AD" and barfreq <> "AW" then raiseruntimeerror("不支援大頻率跨小頻率");

 input: Length(1);

 variable: pdi_value(0), ndi_value(0), adx_value(0);

 SetInputName(1, "天數");

 xf_DirectionMovement("M", Length, pdi_value, ndi_value, adx_value);

// 初始區波動較大, 先不繪出

 //

 if CurrentBar < Length then

  begin

 pdi_value = 0;

 ndi_value = 0;

 adx_value = 0;

  end;

  

Plot1(pdi_value, "月+DI");

  

以上,我是用系統內建的跨頻率指標修改的,我要看月線DMI指標(天數設1),在日k線下看月線DMI,結果設出來有的股票可以正常顯示,有的股票不行。

 以細產業建材指標為例,1802可正常顯示,1603、4506、2597、8444 、5455、8424、5543都看不見

 

排序方式: 標準 | 最新
XQ小幫手 發文於   2020/12/16

topenga0501 您好

請問您碰到空白的時候,

是不是旁邊有呈現" 計算停止,請柬是腳本算是是否分母為0"? 

主要是因為dmi 指標在該股票取過往的值 抓到了0 所導致

這邊您可以選擇

1. 在設定中調整xs指標讀取範圍

2. 使用以下條件 把數值限制大於0才劃線

// XQ: DMI指標
//
if barfreq <> "Tick" and barfreq <> "Min" and barfreq <> "D" and 
 barfreq <> "W" and barfreq <> "AD" and barfreq <> "AW" then raiseruntimeerror("不支援大頻率跨小頻率");

input: Length(1);
variable: pdi_value(0), ndi_value(0), adx_value(0);

SetInputName(1, "天數");
if Length<>0 and pdi_value<>0 and ndi_value<>0 and adx_value<>0 then
xf_DirectionMovement("m",Length, pdi_value, ndi_value, adx_value);

// 初始區波動較大, 先不繪出
//
if CurrentBar < Length then
 begin
    pdi_value = 0;
    ndi_value = 0;
    adx_value = 0;
 end;

Plot1(pdi_value, "+DI");

topenga0501 發文於   2020/12/16

可以用了,謝謝小幫手

XQ小幫手 發文於   2020/12/17

不客氣 祝您投資順心^^

發表回覆
Close