Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请教问题

1楼
punkcat401 发表于:2014/1/17 12:04:28

请问以下思路应该怎么写:

多空双向开仓时,做多后,有A B C三种平多仓的方式。

连续三次多头平仓后是盈利的(包括隔夜,今日之前的都算),则全局变量N:=1。

2楼
jinzhe 发表于:2014/1/17 13:50:54

aa:=asset;

a1:=ref(asset,todaybar);

variable:k=0;

if 平仓条件a and 持仓判断 then begin

    平仓语句;

    k:=k+1;

end

if 平仓条件b and 持仓判断 then begin

    平仓语句;

    k:=k+1;

end

if 平仓条件c and 持仓判断 then begin

    平仓语句;

    k:=k+1;

end

 

if k=3 and aa-a1>0 then n:=1;

 

if date<>ref(date,1) then k:=0;

3楼
punkcat401 发表于:2014/1/17 14:02:54

我描述的不准确,应该是每次多头平仓后都是盈利的,这样连续三次

 

而不是平仓三次后,总和是盈利的,所以没法用ref(asset,todaybar)来比较

 

连续三次盈利,是包括隔夜的,不要求都在日内,不用初始化为0吧,if date<>ref(date,1) then k:=0;

 

4楼
jinzhe 发表于:2014/1/17 14:27:22

variable:k=0;

if 平仓条件a and 持仓判断 then begin

    平仓语句;

    if numprofit(1)>0 then k:=k+1;

    if numprofit(1)<=0 then k:=0;

end

if 平仓条件b and 持仓判断 then begin

    平仓语句;

    if numprofit(1)>0 then k:=k+1;

    if numprofit(1)<=0 then k:=0; 

end

if 平仓条件c and 持仓判断 then begin

    平仓语句;

    if numprofit(1)>0 then k:=k+1;

    if numprofit(1)<=0 then k:=0;

end

 

if k=3  then n:=1;

 

共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 3 queries.