osdak
發表於 14-3-25 00:41
謝謝教導!之前是看到大大已經說了,但我那時不太明白,現在自己測試了,聽大大再解說,明白了。
osdak
發表於 14-3-25 21:46
大大, 又有問題請教, 如果我想設定每天收市前, 平了我所有的倉, 應如何寫? 我測試如下:
ExitAllPositionsTime = 160000;
Buy=xxxxx;
Sell=xxxxx OR(TimeNum() >= ExitAllPositionsTime);
Short=xxxx;
Cover=xxxxx OR(TimeNum() >= ExitAllPositionsTime);
是否正確? 我測試了似乎沒問題, 但沒信心......
別外, 如果上面正確, 那多空對反時, 我就想不到如何寫, 如:
Buy=xxxxxx;
Short=xxxxxx;
Sell = Cover = (TimeNum() >= ExitAllPositionsTime);
Buy = Cover = ExRem(Buy, Short);
Short = Sell = ExRem(Short, Buy);
但結果是會坐盤過夜.........謝謝指導.
andrewchan
發表於 14-3-25 23:06
kilroy 發表於 14-3-24 08:45 static/image/common/back.gif
Hi,
小弟覺得是計算還有欄位的問題
Hi,
因我是新手, 請問可否用短消息發聯絡給我? 謝!
osdak
發表於 14-3-26 21:13
經過我兩天測試, 我發現了, 似乎ibcontroller可以自動buy和short, 但sell和cover郤不會, 再研究, 我想問題出在這裡:
我按紅色按鍵也好, 他自動平倉也好, 都會出現問題, 我看來是 currency問題, 大大有沒有什麼好提議? 我google了但看來沒有其他人有這問題........
謝謝!!
joshsmi
發表於 14-3-26 23:26
本帖最後由 joshsmi 於 14-3-26 23:30 編輯
andrewchan 發表於 14-3-24 07:54 static/image/common/back.gif
Hi,
以下是Backtest mode
Your code is wrong
You can imitate individual backtest in exploration also.
See here example made by someone of the AmiBroker forum
Exploration
http://i.imgur.com/4gfqbIL.png
Default backtest without custom backtest usage
http://i.imgur.com/Fl48XMQ.png
As you can see same output of same column names
andrewchan
發表於 14-3-27 06:45
joshsmi 發表於 14-3-26 23:26 static/image/common/back.gif
Your code is wrong
You can imitate individual backtest in exploration also.
Hi Joshsmi,
It's amazing, could you pls tell me what are the AFL codes I need to insert to my orig AFL in order to make the result of backtest & explore mode the same? Thx a lot!
osdak
發表於 14-3-27 13:25
andrewchan 發表於 14-3-27 06:45 static/image/common/back.gif
Hi Joshsmi,
It's amazing, could you pls tell me what are the AFL codes I need to insert to my ori ...
hi andrew,
just wonder why you so insist to have the same result? i suppose you want to get the signal from explorer and then trade it manually? will you try to make it auto? i am studying it but i am stuck now.....{:4_161:}
andrewchan
發表於 14-3-27 20:31
Hi Joshsmi,
Yes, I want to do the auto trade, thx!
joshsmi
發表於 14-3-27 22:59
andrewchan 發表於 14-3-27 20:31 static/image/common/back.gif
Hi Joshsmi,
Yes, I want to do the auto trade, thx!
我不是osdak ;)
As for autotrading, there are examples in Read me file of IBcontroller. Also look at examples by user Barry Scarborough in AB's users library. There are others too there.
andrewchan
發表於 14-3-27 23:39
joshsmi 發表於 14-3-27 22:59 static/image/common/back.gif
我不是osdak ;)
As for autotrading, there are examples in Read me file of IBcontroller. Also look a ...
Pls accept my apologies for the typo on my last message.
kilroy
發表於 14-3-28 00:32
osdak 發表於 14-3-25 21:46 static/image/common/back.gif
大大, 又有問題請教, 如果我想設定每天收市前, 平了我所有的倉, 應如何寫? 我測試如下:
ExitAllPositionsTi ...
Hi,
搞定了嗎?
小弟最近沒來回覆~ 不知道大大目前狀況如何了?
osdak
發表於 14-3-28 00:37
joshsmi 發表於 14-3-27 22:59 static/image/common/back.gif
我不是osdak ;)
As for autotrading, there are examples in Read me file of IBcontroller. Also look a ...
haha, but i am!
i am desperately looking for more info. on autotrading. thanks for the info, i think i need to take a look on barry's material.
osdak
發表於 14-3-28 00:51
kilroy 發表於 14-3-28 00:32 static/image/common/back.gif
Hi,
搞定了嗎?
hi, 經過多日測試, 還有兩個問題, 第一個是在於ibcontroller, 我於上面的帖提出了, 我發現我的平倉單是下不了, 而且currency會是usd, 明天會繼續研究.
第二個問題, 是關於 barcomplete,
barcomplete = BarIndex() < LastValue(BarIndex());
我不加barcomplete, 於ib中是可以自動下單(但平不了倉, 就是因為上面的原因), 但一加barcomplete, 就沒有下單, 我發
現有人問過相同問題:
www mail-archive com/amibroker@yahoogroups.com/msg36321.html
但可惜沒人回答.但我不加barcomplete, 因為是用cross, 所以AB於K中不停下單(因為不停穿來穿去.....{:4_186:})
我的想法是, barcomplete是比較現在的barindex,如果一有新的barindex----lastvalue(barindex()), 那就會回傳true
給barcomplete, 但這一刻, 其實已經在跑新的K, 那就是說, 於buy= cross(xxx) and barcomplete中, cross(xxx)於當
根K是TRUE時, barcomplete是false, 一直到barcomplete是TRUE時, 那cross(xxx)已經不再是TRUE了, 所以就無法下
單....但想歸想,google的結果是大家都說可以用, 那就應該是有些東西我還沒弄明白........會再研究......
kilroy
發表於 14-3-28 01:58
osdak 發表於 14-3-28 00:51 static/image/common/back.gif
hi, 經過多日測試, 還有兩個問題, 第一個是在於ibcontroller, 我於上面的帖提出了, 我發現我的平倉單是下 ...
Hi,
沒辦法下出去是因為
barcomplete 和 newbar 相互抵觸
所以 new那邊要改寫一下
參考看看了
joshsmi
發表於 14-3-28 02:49
osdak 發表於 14-3-28 00:51 static/image/common/back.gif
hi, 經過多日測試, 還有兩個問題, 第一個是在於ibcontroller, 我於上面的帖提出了, 我發現我的平倉單是下 ...
AB's Status() function has these options for bar completion
From the AB manual www.amibroker.com/guide/afl/status.html
"lastbartimeleft" - returns number of seconds to the completion of current last bar. Works for time-based bars only. Note that for proper operation this requires database timeshift to be set properly (so dates displayed on chart match your local computer time zone). (v5.60)
"lastbartimeleftrt" - it works like "lastbartimeleft" but uses the most recent RT stream update time instead of Now(). Also added Status("lastrtupdate") - time of last RT stream update depends on RT plugin to deliver correct DateUpdate / TimeUpdate data. If plugin or date source sends incorrect datetimestamps or does not send DateUpdate/TimeUpdate correctly this function will not operate properly. Note that most data sources send weird (not current) datetime stamps on weekends. Also IQFeed plugin sends DateUpdate/TimeUpdate only inside regular trading hours. (v5.60)
So try this
diff = Interval() - Status( "lastbartimeleft" ); // or Status( "lastbartimeleftrt" );
Secondsafter = 5; // 5 seconds after bar completion
Title = StrFormat( "%g", diff );
if ( diff == Secondsafter || diff == ( Interval() + Secondsafter ) ) // if x seconds after bar completion
{
Say( "Hello" );
}
頁:
1
2
3
4
5
[6]
7
8
9
10
11
12
13
14
15