COCO研究院

 找回密碼
 註冊
搜索
查看: 3635|回復: 11

AFL掃描AB數據

[複製鏈接]
發表於 15-3-11 12:55 | 顯示全部樓層 |閱讀模式
各位大大,我有實時Tick數據通過real time feed保存到AB中,如何用AFL自動把Tick數據規整成1分鐘HLOC和5分鐘HLOC數據,AB的Charting裡面可以選擇1,5,15,30分鐘,AFL有現成的函數幹這個嗎?
發表於 15-3-11 19:13 | 顯示全部樓層
可以用fopen, fputs匯出成文字檔
發表於 15-3-11 19:45 | 顯示全部樓層
小弟是用這個 AFL 參考看看

/*
Export intraday and EOD data to TXT files
One file for each stock
In the first line insert the directory you want to save them to, make sure the
directory exists
Select your charts to export with the "Apply to" filter in AA window
Select the timeframe period you want to save as using the AA "Settings"
Press Scan button
by Graham Kavanagh 05 Feb 2004
*/

fh = fopen( "c://RPT/"+Name()+".txt", "w");
if( fh )
{
   fputs( "Date,Time,Open,High,Low,Close,Volume \n", fh );
   y = Year();
   m = Month();
   d = Day();
   r = Hour();
   e = Minute();
   n = Second();

   for( i = 0; i < BarCount; i++ )
   {
      //fputs( Name() + "," , fh );
      ds = StrFormat("%02.0f-%02.0f-%02.0f,",
                     y[ i ], m[ i ], d[ i ] );
      fputs( ds, fh );

      ts = StrFormat("%02.0f:%02.0f:%02.0f,",
                     r[ i ],e[ i ],n[ i ] );
      fputs( ts, fh );

      qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n",
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
      fputs( qs, fh );
   }

   fclose( fh );
}

Buy = 1;

發表於 15-3-11 22:47 | 顯示全部樓層
If you wanna convert tickdata to other intervals and wanna keep it in the AmiBroker database then you don't need to export the data. You may use AddToComposite to convert tickdata into other intervals. It is much faster than export of data and re-importing it again.

Secondly you are not limited to 1,5,15,30 intervals. You can customize any other interval. Besides in the toolbar you can insert any interval to be charted.

In backtester you have to go to backtest settings > periodicity. In order to make custom interval being visible there you have to define those custom intervals in Tools - Preferences - Intraday.

Chart time frame and analysis time frame settings are independent from each other!
But both are dependent on File - Database settings - Base time interval!
發表於 15-3-19 19:53 | 顯示全部樓層
我發現MC有個週期AB辦不到,就是變動數
例如價格變動20次就畫一根k棒

draw a k line when price changed every 20 times
發表於 15-3-20 18:55 | 顯示全部樓層
lwhuang 發表於 15-3-19 19:53
我發現MC有個週期AB辦不到,就是變動數
例如價格變動20次就畫一根k棒

Mate, what are you talking about?
Do you mean 20-Range bars or 20-tick charts or what do you mean?

http://www.amibroker.com/kb/2014/09/19/how-to-display-range-bars/

See Interval Selector combo-box of the tool bar
to get 20 tick range bar you insert 20R or 20r,
to get 20-tick interval you insert 20T or 20t

fix interval settings i.e. for creating tool bar buttons can be set in  Tools – Preferences - Intraday
http://www.amibroker.com/kb/2014 ... or-custom-interval/


評分

參與人數 1金錢 +2 收起 理由
lwhuang + 2 感謝分享

查看全部評分

發表於 15-3-20 21:59 | 顯示全部樓層
除了N-tick, N-Range外還有N-volume chart
不知道這邊有沒有人真的使用這些chart做交易呢?
發表於 15-3-22 08:11 | 顯示全部樓層
joshsmi 發表於 15-3-20 18:55
Mate, what are you talking about?
Do you mean 20-Range bars or 20-tick charts or what do you mean? ...

N-range is the same as N-changed?

發表於 15-3-22 22:06 | 顯示全部樓層
lwhuang 發表於 15-3-22 08:11
N-range is the same as N-changed?

Range bars refer to High-Low range.

So do you mean Open-Close change?



發表於 15-3-23 08:19 | 顯示全部樓層
I mean price change
for example, there are tick such as
10, 11, 10, 10, 10, 9
there are 6 ticks but only 3 price changed, so if I specify 3 changed to form a k bar, this is a k bar, not relevant to range
發表於 15-3-23 20:20 | 顯示全部樓層
本帖最後由 joshsmi 於 15-3-23 20:21 編輯
lwhuang 發表於 15-3-23 08:19
I mean price change
for example, there are tick such as
10, 11, 10, 10, 10, 9

Now I understand what you mean.

BTW, are you the one who posted #2683 in the AmiBroker feedback center?

Quote:
"need a special period
fixed change price to form a k line rather than fixed time
, for example, a k represent every 20 price changed .... "


To be honest that one is not as clear as your description you have posted here in your most recent post.
I think Tomasz & AmiBroker will not understand what you exactly mean too as your description there in the feedback center is a very, very vague one. In programming precise descriptions are needed.

If I were you I would post an additional comment in #2683 of feedback center being similar to the one you posted here.

發表於 15-3-24 11:04 | 顯示全部樓層
joshsmi 發表於 15-3-23 20:20
Now I understand what you mean.

BTW, are you the one who posted #2683 in the AmiBroker feedback ce ...

Ya, that's my post
I add the description here to there
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-5-4 07:35

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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