請選擇 進入手機版 | 繼續訪問電腦版

COCO研究院

 找回密碼
 註冊
搜索
123
返回列表 發新帖
樓主: 小娃

[教學] 洞悉AmiBroker的backtester框架(作者 michael-knight)

 關閉 [複製鏈接]
發表於 09-11-10 15:15 | 顯示全部樓層
好專業!
michael-knight真是用心!
發表於 09-11-10 17:16 | 顯示全部樓層
本帖最後由 michael-knight 於 09-11-10 05:20 PM 編輯

用AB來即時執行策略,將Amibroker接上real-time tick quote data,啟動AA視窗,勾選"run every xxx",此選項能夠每隔xxx時間去跑一次AFL,但此timer觸發ALF執行只對Explore或scan動作類型有效用。
在MT4裡,每有tick data到達就會驅動執行策略,但在AB裡似乎沒發現有這樣的驅動機制,而是設定一個timer來觸發策略執行


1.  AFL in explore or scan action
filter = xxx  //explore動作類型用到此變數,指定過濾條件
buy/sell/short/cover //scan動作類型用到此變數,指定交易信號
if (status("action")==actionExplore || status("action")==actionScan) {
//do your action,若你是用IB(interactive broker)這家券商下單,AB提供直接操作IB TWS介面的方法(ActiveX/COM物件)
//若你用其它券商提供的下單元件(ActiveX/COM或一般包成*.dll的API),可以以AFL plug將這些功能包成AFL function再plugin進來,如此你就能調用這些AFL function,達到自動交易
}

2. 軟體骨幹層次(layer)切割分明的話系統是比較完美,有助於唯護與拓展,在VC這邊,使用者可以架上一層訂單管理層來處理一切訂單行為,最底層才是實際下單的API
發表於 09-11-10 17:53 | 顯示全部樓層
我是知道"Run Every XXX"這招
不過這只是讓他一直跑在Exploration mode
要把AB接上券商的API好像不是那麼容易(或是我看不懂)
發表於 09-11-10 18:34 | 顯示全部樓層
好專業
對我們真的很有幫助
謝謝
 樓主| 發表於 09-11-10 20:18 | 顯示全部樓層
剛才michael-knight跟我說,
文章裡的"調用"函式改成"呼叫"函式,
才是台灣人的用語。我改好了。
發表於 09-11-14 13:51 | 顯示全部樓層
圖文並茂,太強了...要好好研究一下
發表於 09-11-28 19:16 | 顯示全部樓層
that perfect
發表於 09-11-28 20:41 | 顯示全部樓層
回復 35# michael-knight


在VC這邊,使用者可以架上一層訂單管理層來處理一切訂單行為,最底層才是實際下單的API
-------------------------------------------------------------------------------------------

可以請教一下什麼是 VC 啊
 樓主| 發表於 09-11-28 23:50 | 顯示全部樓層
回復 41# Gump


    應該是visual C吧。
發表於 09-12-14 16:29 | 顯示全部樓層
回復 36# ezbentley


    參考 IBcontroller 1.3 beta (for IB TWS>=890) , copy past here again :

The IB Controller (BrokerIB.EXE) is a separate application that acts as a buffer between AmiBroker and Interactive Brokers TWS. It accepts commands from AmiBroker and send orders to / retrieves information from TWS. It also allows to cancel/transmit orders manually. The IB controller application is run automatically by AmiBroker if the formula contains the following call:

ibc = GetTradingInterface("IB");

After this call the BrokerIB.EXE (IB Controller) application is launched and the ibc variable contains the pointer to OLE automation object that has several methods (functions) that allow to place/modify/cancel orders via TWS and to query portfolio information. Those methods (functions) are called as any automation object methods, for example:

ibc = GetTradingInterface("IB");

if( ibc.IsConnected() ) // check if connection to IB was successfull
{
   ibc.PlaceOrder("MSFT", "BUY", 100, "MKT", 0, 0, "DAY", False ); // place order but do not transmit yet
}



   意似 要寫code call  ibc interface 而 且 成功 就可 place order , 不 傳出 意是 IB TWS 處 要 manual 去 click
"T" (transmit) button , 如此  是為 測試 應 改成 直接 transmit ---please read readme file in WWW or my attached other place in this forum .
發表於 09-12-14 19:02 | 顯示全部樓層
回復 43# simon48

這個我知道啊
不過只有IB能用
跟其他的broker就不能用了
 樓主| 發表於 09-12-15 13:27 | 顯示全部樓層
本文有更新版。
http://www.coco-in.net/viewthread.php?tid=1446&extra=
新增「如何用AB做自動交易、訂單行為管理說明。」

所以本帖關閉。(關閉就是不可再回覆的意思)
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-3-29 09:11

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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