Rss & SiteMap

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

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

标题:开仓后,当根K获利100点就平仓怎么写

1楼
清风 发表于:2013/4/10 14:03:47
如没有获利100点,当根K收盘就平仓
2楼
jinzhe 发表于:2013/4/10 14:10:00
开仓那根k线进行操作?
3楼
清风 发表于:2013/4/10 15:08:50

是的,开仓这根K操作,一开仓,当根K获利100点就平仓

如没有获利100点,当根K收盘就平
,信号一出就下单

4楼
jinzhe 发表于:2013/4/10 15:18:49
你好,需要处理这样精细的问题,至少需要专业版,请用户出示专业版账号
5楼
清风 发表于:2013/4/10 15:32:02
专业版已购买,尾号502
6楼
jinzhe 发表于:2013/4/10 15:41:37

if 下单条件 then begin
 tbuy(tholding=0,1,mkt);
 extgbdataset('time',time);
end
//开仓后,当根K获利100点就平仓怎么写
if islastbar and time=EXTGBDATA('time') and c-TENTERPRICE>=100*mindiff then tsell(1,1,mkt);
//如没有获利100点,当根K收盘就平仓

if islastbar and time=extgbdata('time') and c-enterprice<100*mindiff and extgbdata('time')-dynainfo(207)>0 and  extgbdata('time')-dynainfo(207)<=2 then

tsell(1,1,mkt);

 

//这个是想到的思路,需要等明天开盘后进行验证

7楼
wn10000neng 发表于:2013/4/10 22:49:33
这个实现起来不难的
8楼
jinzhe 发表于:2013/4/11 9:49:16

RUNMODE:1;
cond:=c>o;
cond1:=islastbar and time=EXTGBDATA('time') and c-TENTERPRICE>=100*mindiff;
cond2:=islastbar and time=extgbdata('time') and c-tenterprice<5*mindiff and TIMETOT0(extgbdata('time'))-timetot0(dynainfo(207))>0 and  timetot0(extgbdata('time'))-timetot0(dynainfo(207))<=2;
if cond and ISLASTBAR  then begin
 tbuy(tholding=0,1,mkt);
 extgbdataset('time',time);
end
//开仓后,当根K获利100点就平仓怎么写
if  cond1 then tsell(1,1,mkt);
//如没有获利100点,当根K收盘就平仓

if cond2 then tsell(1,1,mkt);

DEBUGFILE('d:\test.txt','下单条件是否成立 是 %.0f',cond);
DEBUGFILE('d:\test.txt','平仓条件1是否成立 是 %.0f', cond1);
DEBUGFILE('d:\test.txt','平仓条件2是否成立 是 %.0f',cond2 );

//DEBUGFILE('d:\test.txt','当前k线时间是 是 %.0f',extgbdata('time'));
DEBUGFILE('d:\test.txt','当前k线秒数时间是 是 %.0f',TIMETOT0(extgbdata('time')));
DEBUGFILE('d:\test.txt','当前秒数是 是 %.0f',timetot0(dynainfo(207)));
DEBUGFILE('d:\test.txt','k线走完所剩秒数 是 %.0f',TIMETOT0(extgbdata('time'))-timetot0(dynainfo(207)));
DEBUGFILE('d:\test.txt','开仓价 是 %.0f',tenterprice);
DEBUGFILE('d:\test.txt','最新价 是 %.0f',c);
DEBUGFILE('d:\test.txt','价差 是 %.1f',tenterprice-c);

9楼
jinzhe 发表于:2013/4/11 9:51:07

这个是经过修改测试之后的代码,条件不成立k线结束前平仓已经没有问题,当根k线获利100点这个条件很难成立,所以没有检测到

 

策略最后的调试代码非常重要,测试条件是否成立。

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


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