以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  急求:日盈亏超过N值平仓并不再开仓的写法  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=49106)

--  作者:zj9636
--  发布时间:2013/3/2 10:21:42
--  急求:日盈亏超过N值平仓并不再开仓的写法
日盈亏 需要调用开平仓之后的数值,才是正确的
--  作者:qwe123
--  发布时间:2013/3/3 9:51:03
--  
variable:c1:=1;
r1:=barslast(date<>ref(date,1));
if r1=0 then c1:=1;

r2:=asset-ref(asset,r1+1);
r3:=ref(asset,r1+1)-asset;

if r2>n1 then c1:=-1;
if r3>n2 then c1:=-1;
.............
.............
if cond1 and c1>0 then
begin
sellshort.......
buy..............
end
if cond2 and c1>0 then
begin
sell.......
buyshort......
end

if c1<0 then
begin
sell.........
sellshort......
end




[此贴子已经被作者于2013-3-3 9:51:59编辑过]

--  作者:zj9636
--  发布时间:2013/3/10 14:45:07
--  
 VARIABLE: YTDASSET=0;
IF DATE<>REF(DATE,1) THEN BEGIN YTDASSET:=ASSET;END 
MAXRKKC:=REF(ASSET-YTDASSET,1)>-KS;
MAXRKPC:=REF(ASSET-YTDASSET,1)<-KS;

多谢!请问这种写法是正确的吗