Rss & SiteMap

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

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

标题:请问这段代码为何在图表上没有收盘平仓的信号?

1楼
mao100003801 发表于:2012/12/6 13:04:12

//买开执行
if cond1  and time <151200  then
 begin
 if holding<0 then bp0:SELLSHORT(1,0,THISCLOSE);//平空 
 if holding=0 then bk1:buy(1,1,THISCLOSE);//开多
 exit;
 end
//平多:
if (cond3 or cond31) and holding>0 then
 begin
 sp1:SELL(1,0,THISCLOSE);//平多
 end

//卖开执行
if cond2  and time <151200 then
 begin
 if holding>0 then  sp0:SELL(1,0,THISCLOSE);//平多
 if holding=0 then  sk1:buySHORT(1,1,THISCLOSE);//开空
 exit;
 end


//多单止损
cond32:=close<Ma(close,5);
if holding>0 then
begin
bkpp:=AVGENTERPRICE;
if close<bkpp-losspoint and cond32 then 多单止损:SELL(1,0,THISCLOSE);//平多
exit;
end

//空单止损
cond41:=close>MA(close,5);
if holding<0 then
begin
skpp:=AVGENTERPRICE;
if close>skpp+losspoint and cond41 then 空单止损:SELLSHORT(1,0,THISCLOSE);//平空
exit;
end

//收盘平仓
if time >151200 and holding<>0 then
begin
 if holding<0 then 收盘平空:SELLSHORT(1,0,THISCLOSE);//平空
 if holding>0 then 收盘平多:SELL(1,0,THISCLOSE);//平多
 end

 

 

2楼
jinzhe 发表于:2012/12/6 13:13:32
exit是何用意?
3楼
mao100003801 发表于:2012/12/6 22:44:08
exit用来防止在同一根K线上开平仓。这个会影响最后一段的执行么?
4楼
RogarZ 发表于:2012/12/6 23:34:08

不明白你exit的意思 同一根开平用enterbar去控制就行了。

 

没有完整的代码,不清楚你这个为什么没有在收盘前平仓。

你试着自己用金字塔的调试功能 单步跟踪下看看。若不会用的话,参考金字塔高级教程

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


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