请管理进来帮忙查看一下代码是否有问题 [金字塔]
- 咨询内容:
huichechangliang:=3;//回撤值常量
开仓点差:h-TENTERPRICE,LINETHICK0;
if cross(TOPENPROFIT,3000) THEN extgbdataset('huichechangliang',3.5);
{多头回撤平仓}
if h-TENTERPRICE>huichechangliang and tbuyholding(0)>0 and extgbdata('jiluqi22')=0 then begin
extgbdataset('tiqujia',h);//
extgbdataset('jiluqi22',1);
end//记录器
if h>extgbdata('tiqujia') and tbuyholding(0)>0 then extgbdataset('tiqujia',h);
if l<(extgbdata('tiqujia')-huichechangliang) and tbuyholding(0)>0 then begin
tsell(1,0,mkt),orderqueue;
extgbdataset('jiluqi22',0);
DEBUGFILE('C:\st1\ST11.TXT','多头回撤平仓%.2f',1);
end
{空头回撤平仓}
if TENTERPRICE-l>huichechangliang and TSELLHOLDING(0)>0 and extgbdata('jiluqi22')=0 then begin
extgbdataset('tiqujia',l);
extgbdataset('jiluqi22',1);
end
if l<extgbdata('tiqujia') and TSELLHOLDING(0)>0 then extgbdataset('tiqujia',l);
if h>(extgbdata('tiqujia')+huichechangliang) and TSELLHOLDING(0)>0 then begin
TSELLSHORT(1,0,mkt),orderqueue;
extgbdataset('jiluqi22',0);
DEBUGFILE('C:\st1\ST11.TXT','空头回撤平仓%.2f',1);
end{------------------停损交易-----------------------}
zhisunjiaoyi:=0;//停止交易
if date<>ref(date,1) then dangqianzich:=tasset;//当前资产
kechengshouk:=dangqianzich*0.025;//可亏损承受
if cross(dangqianzich-tasset,kechengshouk) then begin
tsell(TBUYHOLDING(1)>0,0,mkt);
tsellshort(TSELLHOLDING(1)<0,0,mkt);
extgbdataset('zhisunjiaoyi',1);
DEBUGFILE('C:\st1\ST11.TXT','停损交易%.2f',1);
end
{----------------------移动止损----------------------}
zhisunch:=5;//止损常量
kaidansu:=1;//kaidansu
if cross(tasset-dangqianzich,1800) THEN zhisunch:=5;
止损位:TENTERPRICE-zhisunch,LINETHICK0;
if TENTERPRICE-zhisunch and TBUYHOLDING(1)>0 then tsell(1,0,mkt);//多清
if TENTERPRICE+zhisunch and TSELLHOLDING(1)>0 then tsellshort(1,0,mkt);//空清
{------------------------------------------------------}
平仓历时:TEXITBARS(1),LINETHICK0;
实际持仓:tholding2,LINETHICK0;
if tholding>0 then tsell(平多 or 平多1 or 开空,0,lmt,l),orderqueue;//多平
if tholding<0 then tsellshort(平空 or 平空1 or 开多,0,lmt,h),orderqueue;//空平
fenmiaok:TIMETOT0(DYNAINFO(207))-TEXITBARS(1),LINETHICK0;//分秒
huansuan:=2;//换算
if TEXITBARS(1)>0 and fenmiaok<10 THEN extgbdataset('huansuan',0);
if TEXITBARS(1)>0 and fenmiaok>10 then extgbdataset('huansuan',1);
if entertime then BEGIN
if tholding2=0 and zhisunjiaoyi=0 and huansuan>0 then Tbuyshort(开空,kaidansu,lmt,l),orderqueue;//多平
if tholding2=0 and zhisunjiaoyi=0 and huansuan>0 then tbuy(开多,kaidansu,lmt,h),orderqueue;//空平
end
{--------------------时间平仓----------------------}
if exittime then BEGIN
tsell(TBUYHOLDING(1)>0,0,mkt);//多清
tsellshort(TSELLHOLDING(1)>0,0,mkt);//空清
end - 金字塔客服:
没有问题的,如果不想看到提醒,那么在代码最开始加这样一句:WARNING_DISABLE:4;
- 用户回复:
可是为什么程序没有移动止损,明明行情出来了,却不动作
- 网友回复:
zhisunch:=5;//止损常量
kaidansu:=1;//kaidansu
if cross(tasset-dangqianzich,1800) THEN zhisunch:=5;
止损位:TENTERPRICE-zhisunch,LINETHICK0;
if TENTERPRICE-zhisunch and TBUYHOLDING(1)>0 then tsell(1,0,mkt);//多清
if TENTERPRICE+zhisunch and TSELLHOLDING(1)>0 then tsellshort(1,0,mkt);//空清
亏损5个点不止损呀 - 网友回复:
zhisunch:=5;//止损常量
kaidansu:=1;//kaidansu
if cross(tasset-dangqianzich,1800) THEN zhisunch:=5;
止损位:TENTERPRICE-zhisunch,LINETHICK0;
if TENTERPRICE-zhisunch and TBUYHOLDING(1)>0 then tsell(1,0,mkt);//多清
if TENTERPRICE+zhisunch and TSELLHOLDING(1)>0 then tsellshort(1,0,mkt);//空清
亏损5个点不止损呀
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容