图书序言
开盘区间突破(Open Range Breakout,ORB)
ORB是一种很常见的当沖策略,Open就是指开盘,它的交易方式是取开盘一段特定期间内的高、低点作为区间,至于要取多久期间则看使用者的交易策略,有的人取15分、30分、60分,突破此区间则作多,跌破此区间则作空,图3-1是取开盘15分钟的ORB。图中的区间是突破100作多,跌破98作空,这是基本型的例子;衍伸型的例子会有加入许多个人条件,比如:突破此区间后回档不破此区间高点则作多,跌破此区间反弹不过此区间低点则作空,开盘要爆量…等。
图3-1 ORB 15分范例图
这一节先介绍如何设计开盘后15分钟ORB程式:
if barfreq<>"Min" or barinterval<> 1 then raiseruntimeerror("Sorry,本脚本只适用于1分钟线");
variable:barcount(0),H15(0),L15(0);
if date <> date[1] then barcount=1 else barcount+=1;
if barcount = 15 then //目前为时间上已来到了AM09:15:00
begin
H15 = highest(high,15);//前15分钟的最高价
L15 = lowest(low,15);//前15分钟的最低价
end;
condition1=false;
if close > H15 then
begin
condition1 = true;
retmsg = "Long"; //ORB买进讯号
end;
condition2=false;
if close < L15>begin
condition2 = true;
retmsg = "Short"; //ORB放空讯号
end;
ifbarcount>=16 and (condition1 or condition2) then ret=1;