等级: 机构版
- 注册:
- 2021-5-20
- 曾用名:
|
楼主 |
发表于 2023-9-4 09:25
|
显示全部楼层
VARIABLE:KZYDD:= 0;//空止盈低点
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=2*(DIF-DEA);
开空条件:= CROSS(DIF,DEA);
平空条件:= CROSS(DEA,DIF);
//开多参数循环
VARIABLE:KZYDD_ARRAY[2]:=0;
KZYDD_ARRAY[1]:=0.002;//只能调用一次
KZYDD_ARRAY[2]:=0.1;//0.1
日期:=DATE + 19000000;
时间:=time;
time1:=NUMTOSTR(时间,0);
count1 := 0;
数量:=1;
if (ISLASTBAR) >0 THEN begin
FOR index1=1 TO UBOUND(KZYDD_ARRAY) DO
//FOR NUM=1 TO 2 DO
BEGIN
val1:=KZYDD_ARRAY[index1];
KZYDD := val1;
count1:=count1+1;
//////----------------------------------------------
IF 开空条件 AND THOLDING=0 THEN BEGIN
开空:TBUYSHORT(1 ,1,MKT), ALLOWREPEAT;
END
//跌破持仓价格直接止损
IF C > (TAVGENTERPRICE+ TAVGENTERPRICE * KZYDD) and THOLDING < 0 THEN BEGIN
空止损:TSELLSHORT(THOLDING < 0 ,1,MKT), ALLOWREPEAT;
END
IF 平空条件 and THOLDING < 0 THEN BEGIN
平空:TSELLSHORT(THOLDING < 0 ,1,MKT), ALLOWREPEAT;
END
持仓:THOLDING,NODRAW;
//if NUMTOSTR(日期,0) ='20230901' and time1 ='190000' THEN BEGIN
DEBUGFILE('c:\stock\2023-1.log', '第' + NUMTOSTR(count1,0) + '次 '+ NUMTOSTR(KZYDD,4)+ '|'+ NUMTOSTR(日期,0) +' =%.4f',TASSET);
//END;
//交易次数:TOTALTRADE;
胜率:TPERCENTWIN;
END
END
|
|