等级: 免费版
- 注册:
- 2021-9-12
- 曾用名:
|
//1、自第8行到80行:语法没有问题。至于逻辑对不会不清楚。
//2、计算前2根K线是阴线, (收盘价和下引线K线一根比一根低),在计算前根K线的 (收盘k线和下引线小于开盘K线2跳)
//答:这个在原有基础上,增加阴线的判断条件即可。ISUP收阳
//ISUP收阳当收盘>开盘时,//ISDOWN收阴,当收盘<开盘时,返回值为1,否则为0
cond1:REF(close<open,2)>REF(close<open,1) and REF(close,2)>REF(close,1) and REF(low,2)>REF(low,1) and (close-REF(close,1))>2 and (low-REF(low,1))>2*DYNAINFO(208);
cond2:REF(close>open,2)>REF(close>open,1) and REF(close,2)<REF(close,1) and REF(low,2)<REF(low,1) and (close-REF(close,1))<2 and (low-REF(low,1))<2*DYNAINFO(208);
////计算前2根K线收盘价和下引线K线一根比一根低,在计算前根K线的收盘k线和下引线小于开盘K线2跳开多
//cond1:REF(close,2)>REF(close,1) and REF(low,2)>REF(low,1) and (close-REF(close,1))>2 and (low-REF(low,1))>2;
//cond2:REF(close,2)<REF(close,1) and REF(low,2)<REF(low,1) and (close-REF(close,1))<2 and (low-REF(low,1))<2;
//if cond1=1 then BEGIN//取得合约最小变动价位该方法适合在后台程序化交易中使用// REF ISDOWN收阴 >and
// TSELLSHORT();//取得合约最小变动价位该方法适合在后台程序化交易中使用// REF ISUP收阳 > and
// TBUY();
//END
input:多止损跳数(20,1,100,1),多移动止损跳(10,1,100,1),盈利浮度多(3,1,100,1);
input:空止损跳数(20,1,100,1),空移动止损跳(10,1,100,1),盈利浮度空(3,1,100,1);
input:多止盈跳数(5,1,100,1),多止盈跳数(5,1,100,1),手数(1,1,100,1);
//ma5:ma(c,1);
//ma10:ma(c,2);
//ma20:ma(c,3);//MINDIFF最小变动价位//OPENTIME( )开盘时间//CLOSETIME( )收盘时间
////ma30:ma(c,4);//DYNAINFO( 3)昨收//DYNAINFO( 4)今开DYNAINFO(208)取得合约最小变动价位该方法适合在后台程序化交易中使用
//dtpl:ma5>ma10 and ma10>ma20;// and ma20>ma30;
//ktpl:ma5<ma10 and ma10<ma20;// and ma20<ma30;
// 开多:tbuy(dtpl,手数,mkt);
// 开空:tbuyshort(ktpl,手数,mkt);
//tbuy(tbuyholding(1)=0,手数,lmt,o);
//开多
//if dtpl and low then // tbuyholding(1)=0 and
if cond1=1 and low and ISUP then
BEGIN
// begin
开多:tbuy(tbuyholding(1)=0,手数,lmt,o+1*DYNAINFO(208));//,(kdpkj+开加跳*mindiff));// mkt);//>
// 开多:tbuy(1,手数,mkt);
end
////平多
////if ktpl and HIGH then
//if cond2=1 and HIGH and ISDOWN then
// BEGIN
// begin
// 平多:tsell(tbuyholding(1)>0 ,tbuyholding(1),lmt,o-1*DYNAINFO(208)); //(kkpdj-平减跳*mindiff)); // mkt);//
//end
//开空
//if ktpl and HIGH then // tsellholding(1)=0 and
if cond2=1 and HIGH and ISDOWN then
BEGIN
// begin
开空:tbuyshort(tsellholding(1)=0,手数,lmt,o-1*DYNAINFO(208));//,( high-开减跳*mindiff));//mkt);//>
// 开空:tbuyshort(1,手数,mkt);
end
////平空
////if dtpl and low then
//if cond1=1 and low and ISUP then
// BEGIN
//// begin
// 平空:tsellshort(tsellholding(1)>0,tsellholding(1),lmt,o+1*DYNAINFO(208));//(low+平加跳*mindiff)//mkt);//
//end
//多移动止损
//input:多移动止损跳(5,1,100,1);
hh:=hhv(h,tenterbars+1);
xx:=hh-多移动止损跳*DYNAINFO(208);
if c<=xx and TOPENPROFIT>=盈利浮度多*DYNAINFO(208) and tbuyholding(1)>0 then tsell(1,tbuyholding(1),lmt,o-1*DYNAINFO(208));//mkt);
//空移动止损
//input:空移动止损跳(5,1,100,1);
ll:=llv(l,tenterbars+1);
xx:=ll+空移动止损跳*DYNAINFO(208);
if c>=xx and TOPENPROFIT>=盈利浮度空*DYNAINFO(208) and tsellholding(1)>0 then tsellshort(1,tsellholding(1),lmt,o+1*DYNAINFO(208));//mkt);
补充内容 (2021-10-22 18:07):
大师你,我设了必须有盈利2跳回2跳才平仓,为什么都有亏了,,,,帮我改一下大师
补充内容 (2021-10-22 18:11):
看后帮我改一下,必须真盈利,才平仓,为什么有太多的亏 |
|