COCO研究院

 找回密碼
 註冊
搜索
查看: 2478|回復: 5

Trend analysis in Amibroker

[複製鏈接]
發表於 16-5-12 11:29 | 顯示全部樓層 |閱讀模式
想用top-down algorithm做trend definition, 但amibroker好像不能做recursion, 請問有哪位知道應如何解決嗎(不想用sliding window algorithm)﹖

謝謝

發表於 16-5-13 07:51 | 顯示全部樓層
什麼叫top-down?
recursion可以用 for 做
 樓主| 發表於 16-5-16 15:24 | 顯示全部樓層
lwhuang 發表於 16-5-13 07:51
什麼叫top-down?
recursion可以用 for 做

Top down 的意思是給定一個最高standard error 門檻數值。然後在數列中,每次找一個新折點,令加入折點後數列的standard error總和為最小。然後看折好後的數列,如果數列的standard error仍高於門檻的話,用同樣方法處理, 直至每個數列的standard error都少於門檻數值。

因為不知道最終要折多少次,所以iteration approach不能用。

參考pseudo code:
Algorithm Seg_TS = Top_Down(T , max_error)
best_so_far = inf;
for i = 2 to length(T) - 2 // Find best place to split the time series.
    improvement_in_approximation = improvement_splitting_here(T,i);
    if improvement_in_approximation < best_so_far
        breakpoint = i;
        best_so_far = improvement_in_approximation;
    end;
end;
// Recursively split the left segment if necessary.
if calculate_error(T[1:breakpoint]) > max_error
    Seg_TS = Top_Down(T[1: breakpoint]);
end;
// Recursively split the right segment if necessary.
if calculate_error( T[breakpoint + 1:length(T)] ) > max_error
    Seg_TS = Top_Down(T[breakpoint + 1: length(T)]);
end;

以上參考文章為"An Online Algorithm for Segmenting Time Series" from Department of Information and Computer Science, University of California

現在在看Ramer–Douglas–Peucker algorithm會不會比較好, 這個能用iteration解決。

發表於 16-5-18 19:38 | 顯示全部樓層
AFL不支援 recursive 但是 jscript 可以

你可以用內嵌的方式實做......


  1. // test for jscript recursive

  2. EnableScript("jscript");

  3. <%
  4. function Callme( ins )
  5. {
  6. if(ins < 10)
  7. Callme( ins+1 );


  8. var myMsgBox=new ActiveXObject("wscript.shell");
  9. myMsgBox.Popup (ins);
  10. return;
  11. }

  12. Callme(0);

  13. %>
複製代碼
 樓主| 發表於 16-5-19 13:13 | 顯示全部樓層
magier 發表於 16-5-18 19:38
AFL不支援 recursive 但是 jscript 可以

你可以用內嵌的方式實做......

請問內嵌的CODE要加到哪裏﹖又如何才可以RUN﹖
發表於 16-5-20 19:17 | 顯示全部樓層
可以參考官方網頁說明

www. amibroker.com/guide/a_script.html
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-29 19:14

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook