MC回測取消STOP - 財經

By Elvira
at 2011-06-10T16:22
at 2011-06-10T16:22
Table of Contents
※ 引述《hollejacklin (私は不器用です)》之銘言:
: 請問我在用MC做回測時
: 有一段語法是
: if condition then begin;
: buy 1 contract next bar at price stop;
: sellshort 1 contract next bar at price2 stop;
: end;
: 如果 next bar 波動太大 例如 open > price and low < price2
: 可是我的想法是 只要留多倉就好 不打算當天反手
: 那我要怎麼寫才可以取消空單的觸價單
: 謝謝各位解答
這一根 K 棒滿足條件的話下一根 K 棒一開始就會丟出兩張 Stop Order,
所以等跑到下一根 K 棒發現 Open 價遠超過觸價的話,
此時你已無法取消反向邊的 Stop Order。
如果你這個策略僅作為評估操作績效,而不會將它真正上線跑的話,
可以想辦法,在這一根 K 棒時就預先取得下一根 K 棒的開盤價:
if condition then
begin
if open_of_next_bar > price then
buy next bar at price stop
else if open_of_next_bar < price2 then
sellshort next bar at price2 stop
else
begin
buy next bar at price stop;
sellshort next bar at price2 stop;
end;
end;
寫個小程式,將下一根 K 的 Open 價導入變成一個外部資料,讓程式抓!
--
: 請問我在用MC做回測時
: 有一段語法是
: if condition then begin;
: buy 1 contract next bar at price stop;
: sellshort 1 contract next bar at price2 stop;
: end;
: 如果 next bar 波動太大 例如 open > price and low < price2
: 可是我的想法是 只要留多倉就好 不打算當天反手
: 那我要怎麼寫才可以取消空單的觸價單
: 謝謝各位解答
這一根 K 棒滿足條件的話下一根 K 棒一開始就會丟出兩張 Stop Order,
所以等跑到下一根 K 棒發現 Open 價遠超過觸價的話,
此時你已無法取消反向邊的 Stop Order。
如果你這個策略僅作為評估操作績效,而不會將它真正上線跑的話,
可以想辦法,在這一根 K 棒時就預先取得下一根 K 棒的開盤價:
if condition then
begin
if open_of_next_bar > price then
buy next bar at price stop
else if open_of_next_bar < price2 then
sellshort next bar at price2 stop
else
begin
buy next bar at price stop;
sellshort next bar at price2 stop;
end;
end;
寫個小程式,將下一根 K 的 Open 價導入變成一個外部資料,讓程式抓!
--
Tags:
財經
All Comments
Related Posts
MC回測取消STOP

By Sandy
at 2011-06-06T18:36
at 2011-06-06T18:36
MC回測取消STOP

By Faithe
at 2011-06-05T00:52
at 2011-06-05T00:52
市場真的就這樣??!!

By Aaliyah
at 2011-06-03T20:36
at 2011-06-03T20:36
市場真的就這樣??!!

By Harry
at 2011-06-03T02:55
at 2011-06-03T02:55
市場真的就這樣??!!

By Barb Cronin
at 2011-06-02T22:34
at 2011-06-02T22:34