|
trade-commander.com 出產兩TOOL :TWSLINK MTIBBridge
兩者皆對INTERACTIVE BROKERS 下單
http://trade-commander.com/twslink/twslink.htm
http://trade-commander.com/MTIBBridge/MTIBBridge.htm
TWSLINK 我兩年前試過可RUN 有點不穩 但FREE
今天他以收費姿態繼續 是對的 只是 擋了TRY RUN 的路
MTIBBridge 是新產品 試用時發生 將我的CUSTOM INDICATOR 全當STRATEGY
但要RUN的卻ACTIVE BUT NOT RUN
(需經過STOP AND RESTART 就發生 )
TWSLINK USER GROUPAS FOLLOW:
http://tech.groups.yahoo.com/group/twslink/
我貼一WL EXAMPLE FROM GROUP :
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Re: Sample Wealth Lab script?
here is a simple script using TWSLink (from samples dir.)
{This sample demonstrates basic Steps to place an Order}
var lib: ComVariant;
var OpResult: integer=0;
var ID_MSFT: integer=0; {Unique Contract ID}
var Count: integer=0; {set to -1 and start the script}
var EntryID: integer=-1; {Order ID}
if(Count = -1) then
begin
{load the com dll}
lib := CreateOleObject('twslink.comif');
{init the com dll}
lib.INITDLL(2, 'c:\twslinkdll_wl.log', 2, 0, 3, 4000);
{register contract}
ID_MSFT := lib.REGISTER_CONTRACT('MSFT', 'STK', 'USD',
'SMART','','','',0.0,'',0,0.0);
{connect to TWS}
OpResult := lib.CONNECT('127.0.0.1', 7496, 4, 5000);
{place new order}
EntryID := lib.PLACE_ORDER(ID_MSFT, 0, 'SELL', 'LMT', 100, 39.77, 0, 'GTC', 1,
-1, '', '', -1);
{modify order -> raise the limit}
EntryID := lib.PLACE_ORDER(ID_MSFT, EntryID, 'SELL', 'LMT', 100, 39.96, 0,
'GTC', 1, -1, '', '', -1);
end;
Count := Count + 1;
as you can see, function
lib.PLACE_ORDER(ID_MSFT, 0, 'SELL', 'LMT', 100, 39.77, 0, 'GTC', 1, -1, '', '',
-1);
places an order. if you look into documentation, you can find
various functions placing an order, like
BUY_STP, SELL_STP etc.
a briefly documentation of all functions can be found
documentation\exported_functions.txt
your job now: to find the appropiate TWSLink functions for
your ordere below and pass the correct paramters to them.
sample:
SellAtStop(bar+1, (priceOpen(bar+1) - (priceHigh(bar) -
priceClose(bar))), LastPosition, 'open-1/2 exit');
int SELL_STP(id_from_register_this_charts_symbol,
0,
int uidorder,
double stopprice,
int Size,
string tif,
int transmit);
wrote:
>
>
> Here is a simple WL script. How do I program TWSLink to send orders to
> IB?
>
> *************************
>
> var Bar: integer;
> for Bar := 2 to BarCount - 2 do
> begin
> if not LastPositionActive then
> begin
> if (priceClose(bar) < priceOpen(bar)) then
> buyAtStop(bar+1, (priceOpen(bar+1) + (priceClose(bar) -
> priceLow(bar))), 'open+1/2 entry');
>
> if (priceClose(bar) > priceOpen(bar)) then
> shortAtStop(bar+1, (priceOpen(bar+1) - (priceHigh(bar) -
> priceClose(bar))), 'open-1/2 entry');
> end
> else
> begin
> if PositionLong(LastPosition) then
> if (priceClose(bar) > priceOpen(bar)) then
> SellAtStop(bar+1, (priceOpen(bar+1) - (priceHigh(bar) -
> priceClose(bar))), LastPosition, 'open-1/2 exit');
>
> if PositionShort(LastPosition) then
> if (priceClose(bar) < priceOpen(bar)) then
> CoverAtStop(bar+1, (priceOpen(bar+1) + (priceClose(bar) -
> priceLow(bar))), LastPosition, 'open+1/2 exit');
> end;
> end;
>
> ********************
>
> Thank you.
>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|