以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=97554)

--  作者:苦麻菜真好吃
--  发布时间:2016/5/18 10:00:46
--  [原创]
老师帮忙写个策略:


1、取上一交易日5分钟的ATR
2、判断上一日的是收阴还是收阳
3、若上一交易日日线收阳线、则以今天的开盘价做多单,亏损2*ATR止损,停止今天的交易
                                                                       若没有被止损、则收盘平仓。

4、若上一交易日日线收阴、则以今天开盘价开空单,亏损2*ATR止损,停止今天的交易。
                                                                 若没有被止损、则收盘平仓。


谢谢!

--  作者:jinzhe
--  发布时间:2016/5/18 10:04:29
--  
交易周期是什么周期?
--  作者:苦麻菜真好吃
--  发布时间:2016/5/18 10:07:21
--  
5分钟


--  作者:jinzhe
--  发布时间:2016/5/18 10:13:57
--  

variable:bj=0;
m:=14;
TR1 : MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR : MA(TR1,m);

atr_day1:=ref(atr,todaybar);
c1:=callstock(stklabel,vtclose,6,-1);
o1:=callstock(stklabel,vtopen,6,-1);
if todaybar=1 and c1>=o1 and holding=0 and bj=0 then begin
 buy(holding=0,1,limitr,open);
 bj:=1;
end


if todaybar=1 and c1<o1 and holding=0 and bj=0 then begin
 buyshort(holding=0,1,limitr,open);
 bj:=1;
end

if holding>0 and c<=enterprice-2*atr then begin
 sell(1,0,marketr);
end

if holding<0 and c>=enterprice+2*atr then begin
 sellshort(1,0,marketr);
end


if time=closetime(0) then begin
 sell(1,0,marketr);
 sellshort(1,0,marketr);
 bj:=0;
end