IB的實時操作問題
想請教各位大大, 我如果要實時自動操作, 概念是否用scan/explore, 啓動auto-repeat, 不停refresh就可以? 我再想請問加入requesttimedrefresh()作用在那裡?謝謝各位大大.
Hi,
要用 SCAN 下單,設定就如下圖
http://www.coco-in.net/data/attachment/forum/201403/13/1612534gv24vrongwe2g2z.png
按一下 SCAN 就開始掃描(自動下單)了
---
requesttimedrefresh() 這個函數
小弟會這樣做
RequestTimedRefresh(1, onlyvisible = False);
用意是讓圖表更新速度快,且這個圖表的視窗不用開在最上層就可以執行(策略)
不過,如果你要用 SCAN 的方式,那這行有沒有加都沒差了
參考看看囉
kilroy 發表於 14-3-19 23:44 static/image/common/back.gif
Hi,
要用 SCAN 下單,設定就如下圖
thanks kilroy. 你真勤力, 很感動{:4_82:}
那再想請教, 我知道可以用email/wav file alert有signal, 如果我想用requesttimedrefresh()看圖, 那怎樣寫, 才會於實時(我用ib data feed)可以看到red/blue 進出場的arrow? 我在backtest後可以看到, 但實時就不知應如何實現, 可否給點方向?
我都是用auto explore,不知道跟auto scan有什麼差別 osdak 發表於 14-3-20 00:26 static/image/common/back.gif
thanks kilroy. 你真勤力, 很感動
那再想請教, 我知道可以用email/wav file alert有signal, 如果 ...
Hi,
如果是開圖表
請參考 plotshapes 函數
lwhuang 發表於 14-3-20 10:49 static/image/common/back.gif
我都是用auto explore,不知道跟auto scan有什麼差別
Hi,
小弟的認知是,如果用在下單沒差
如果還要顯示 table 的話,explore function 可以做到
---
SCAN 就是單純掃描買賣訊號
小弟的認知有錯誤的話,請補充說明 ^^"
參考看看了~
如果我是想控制每天的下單數目, 請問應如何做? 比如每天做十次買單, 十次賣單? 我寫了個for loop, 於backtest時可以控制次數, 但於實時操作時好像不成, 而且, 我覺得於AMIBROKER中用for loop好像不太正統, 我想應該有一些簡單直接的方法, 請問各大大可以分享一下? 下面是我的code....
Counter = 1;
DN = DateNum();
for(i = 1; i<BarCount; i++)
{
if (Buy == 1 AND Counter == 1)
{
Datecheck = DN;
Counter++;
continue;
}
if (Buy == 1 AND Counter > 1)
{
Datecheck = DN;
if (Datecheck == Datecheck)
{
if(Counter>10)
{
Buy = 0;
}
else
{
Counter++;
}
}
else
{
Counter=1;
Datecheck = DN;
Counter++;
}
}
}
Counter = 1;
DN = DateNum();
for(i = 1; i<BarCount; i++)
{
if (Short == 1 AND Counter == 1)
{
Datecheck = DN;
Counter++;
continue;
}
if (Short == 1 AND Counter > 1)
{
Datecheck = DN;
if (Datecheck == Datecheck)
{
if(Counter>10)
{
Short = 0;
}
else
{
Counter++;
}
}
else
{
Counter=1;
Datecheck = DN;
Counter++;
}
}
}
本帖最後由 joshsmi 於 14-3-21 03:37 編輯
osdak 發表於 14-3-21 01:02 static/image/common/back.gif
如果我是想控制每天的下單數目, 請問應如何做? 比如每天做十次買單, 十次賣單? 我寫了個for loop, 於backte ...
I don't completely understand your text and I haven't checked your code but if you wanna limit the number of trades per day you don't need loop.
// limit number of daily signals
Buy = Cross( MACD(), Signal() );
dn = DateNum();
NewDay = dn != Ref( dn, -1 );// new day marker
BuyNum = Cum( Buy );
DailyBuyNum = BuyNum - ValueWhen( NewDay, BuyNum ); // number of daily signals
Buy = Buy AND DailyBuyNum <= 4; // change the trade number you want to limit
// for test
Plot( DailyBuyNum, "DBN", colorRed, styleStaircase );
Buycolor = colorGreen;
Colorborder = colorLightGrey;
PlotShapes( Buy*shapeSmallUpTriangle, Buycolor, 0, DailyBuyNum, -15 );
PlotShapes( Buy*shapeHollowSmallUpTriangle, Colorborder, 0, DailyBuyNum, -15 );
PlotShapes( Buy*shapeHollowSmallCircle, Buycolor, 0, DailyBuyNum, 0 );
joshsmi 發表於 14-3-21 03:34 static/image/common/back.gif
I don't completely understand your text and I haven't checked your code but if you wanna limit the...
thanks, joshsmi. very nice input.
大大們, 如果我有了buy和short的條件, 但sell和cover只是單單靠賺/賠了多少點而決定, 所以我用了applystop. 但問題就是, amibroker一定要強加sell和cover的條件,那我應該如何做好呢? 謝謝! osdak 發表於 14-3-23 02:37 static/image/common/back.gif
大大們, 如果我有了buy和short的條件, 但sell和cover只是單單靠賺/賠了多少點而決定, 所以我用了applystop. ...
Sell = Cover = 0;
ApplyStop( ....
頁:
[1]