Rss & SiteMap

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

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

标题:怎么以上一个开仓价为基础做反向单。

1楼
jetzhu 发表于:2014/7/26 15:45:36
怎么以上一个开仓价为基础做反向单。平仓后,比如上个开仓是空单,然后平仓后价格大于开仓价,就开仓而且只开一次?
2楼
pyd 发表于:2014/7/26 19:16:43

VARIABLE:n:=0;

if 开多条件 and n=0 then
begin
buy(holding=0,1,market);
n:=1;
end
sell(平多条件 and holding>0,1,market);

if 开空条件 and n=0 then
begin
buyshort(holding=0,1,market);
n:=2;
end
sellshort(平空条件 and holding<0,1,market);

if EXITPRICE-ENTERPRICE>0 and n=2 then buy(holding=0,1,market);//n=2判断上次是开空

if enterprice-EXITPRICE>0 and n=1 THEN buyshort(holding=0,1,market);//n=1判断上次是开多

if time=closetime(0) then n:=0;

3楼
jetzhu 发表于:2014/7/26 23:54:34
如果不是每天限一次,而是每次突破失败后只开一次呢?突破失败的定义是比如做多开仓价大于平仓价··
4楼
jinzhe 发表于:2014/7/28 9:09:50
以下是引用pyd在2014/7/26 19:16:43的发言:

VARIABLE:n:=0;

if 开多条件 and n=0 then
begin
buy(holding=0,1,market);
n:=1;
end
sell(平多条件 and holding>0,1,market);

if 开空条件 and n=0 then
begin
buyshort(holding=0,1,market);
n:=2;
end
sellshort(平空条件 and holding<0,1,market);

if EXITPRICE-ENTERPRICE>0 and n=2 then buy(holding=0,1,market);//n=2判断上次是开空

if enterprice-EXITPRICE>0 and n=1 THEN buyshort(holding=0,1,market);//n=1判断上次是开多

if time=closetime(0) then n:=0;

这里的holidng判断写在和开多开空条件一起判断,不要放在后面

5楼
jinzhe 发表于:2014/7/28 9:14:32

 
[此贴子已经被作者于2014/7/28 9:15:43编辑过]
6楼
jinzhe 发表于:2014/7/28 9:23:30

 

VARIABLE:n:=0;

if 开多条件 and n=0 and holding=0 then
begin
buy(holding=0,1,market);
end
sell(平多条件 and holding>0,1,market);

 

if 开空条件 and n=0  and holding=0 then
begin
buyshort(holding=0,1,market);
end
sellshort(平空条件 and holding<0,1,market);

nn1:=barslast(开多条件);

nn2:=barslast(开空条件);

if nn1>nn2 and exitbars>0 and exitprice>enterprice then n:=1;

if nn1<nn2 and exitbars>0 and exitprice<enterprice then n:=1;

if time=closetime(0) then n:=0;

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


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