You need to enable JavaScript in order to visit our site!
 
Logo PTMC
NAVIGATION
CANCEL
 
or via PTMC account
Restore password
or via PTMC account
Logo PTMC
NAVIGATION
or via PTMC account
Restore password
or via PTMC account
or via PTMC account
Restore password
or via PTMC account
Mac Mac 08.07 2016

5 個步驟教您建立 PTMC 客製化面板

嗨,各位投資人!

您想要透過 PTMC 使績效更好嗎?您想要自訂或開發 PTMC 的無限可能嗎?如果是的話,這就是為您量身打造的。

PTMC 平台上已經內建了各種強大功能,但每位交易者會因目的不同而需要不同的設定,這份指南可以協助您將您的想法在 PTMC 上實踐,而您也無須強大的程式設計知識就可以快速建立一個簡單的擴充功能。

PTMC 擴充功能所使用的 API 跟指標功能、交易系統所使用的是一樣的(Pt# Class)。它可以授予帳戶、部位、不同下單類型、報價等等存取的權限。而且 API 的能耐仍在持續擴展中。

準備開始吧!

1) 建立一個程式開發環境

執行 MS Visual Studio. 選擇 檔案 → 新增 → 專案 在接下來的對話視窗中選擇 “.Net Framework 3.5” 下的 “類別庫 Class Library”.

在 PTMC 的開發環境當中,.NET Framework 3.5 是很重要的工具。

Create the coding environment for new plug-in in PTMC trading platform

2) 在方案總管(Solution Explorer)中加入參考

Rightclick on References → Add Reference

 Add references in Solution Explorer

Browse for additional PTLRuntime.dll and Commons.dll files from the PTMC root folder (AppData\Roaming\ProtraderMC(xxbit)). These files basically introduce API and are crucial for PTMC add-ons functioning.

3) Create a user interface

As to define a plug-in's graphic view, add Form in Solution Explorer (rightclick on your Classname and select Add → Windows Form).

Add windows form for new user interface

Create a user interface using standard Visual Studio Designer. Lets add some button to perform actions with.

Create a user interface for "Hello world" plug-in in PTMC trading platform

To test and debug your plug-in, left click on button to create a Click Event then paste the message display code: MessageBox.Show (“Your text”).

test and debug the plug-in

4) Provide programmable logic to your plug-in

Continue working in your Form Class (not in Main). In order to create plug-in for PTMC terminal you must place attribute [Exportable] before your class declaration and implement IExternalComponent interface.

Write the programmable logic to your plug-in

This interface should contain information about your plug-in. Below is the list of properties and methods:


ComponentName

provides name of your future component, which would be used in terminal's tools menu

Content

sets control panel of user interface, which would be displayed in terminal

IconImage

sets Image for plug-in apart of content

PanelHeader

sets name of plug-in in tabs of terminal

Populate()

notifies about finished server connection and ability to use data from cache

Note: You must redefine IExternalComponent properties.

5) Compile and run your Plug-in

Compile application, then copy HelloWorld.dll file to Documents\ProtraderMC (xxbit)\My plug-ins. Now you can launch PTMC and find plug-in by going to Tools Pro Panels section in main menu.

Compile and run your Plug-in

Worth to note that Plug-in's updates would take an effect once terminal starts.

"Hello world" plugin has been launched in PTMC trading platform

For debugging purposes return to Visual Studio menu Debug → Attach to Process, then select process netclient.exe.

Note: keep your PTMC client live with running plug-in

While in debugging mode try to place breakpoint at testButton_Click () and study step by step how the code runs and behaves by triggering button in terminal.

Debugging process in PTMC trading platform

Recap

This simple guide partialy unveils PTMC's API unlimited possibilities for building your successful winning strategy and we hope you feel like to try out more. Have fun and unleash your ideas with happy coding!

Discussion
Join PTMC community to post your comments
No comments yet. Be the first.
PTMC 是一個專業的交易平台,結合了強大的圖表和分析工具,並可在不同的金融市場進行交易。 它是由 PFSOFT UK LTD 開發的,該公司是全球銀行和經紀商交易技術提供商
© 2021. PTMC 為基於 Protrader 技術的專業交易平台
地址
臺北市大安區羅斯福路3段273號5樓
聯絡我們
電話: +886-2-2367-8583
E-mail: service@kcdatanet.com
社群
© 2021. PTMC 為基於 Protrader 技術的專業交易平台