
等级: 新手上路
- 注册:
- 2024-12-20
- 曾用名:
|
编辑的程序图标有显示买入或卖空,但是模拟账户交易没有交易。或者开仓后立即平仓是什么原因。
VARIABLE:KDC=2,KKC=2; //定义全局变量标记,初始值为2手
1min:=stkindi('','A.GL',0,1,0);
5min:=stkindi('','A.GL',0,2,0);
// 买入条件
KD:= 1min > 50 AND 5min > 50 ;
// 卖出条件
KK:=1min < -50 AND 5min < -50;
//平仓条件
PD:5min < 0 AND REF(5min,1)>10 AND 1min < 0;
PK:5min > 0 AND REF(5min,1)<-10 AND 1min > 0;
//开仓语句
if KD and KDC > 0 then begin
BUY(KD,1,THISCLOSE ); //开多
KDC:=KDC-1;
END
if KK and KKC > 0 then begin
BUYSHORT(KK,1,THISCLOSE ); //开空
KKC:=KKC-1;
END
//平仓语句。
if PD AND KDC<>2 then
begin
SELL( PD,'' ,THISCLOSE );//平多
KDC:=2;
end
if PK AND KKC<>2 then
begin
SELLSHORT(PK ,'' ,THISCLOSE );//平空
KKC:=2;
end
补充内容 (2025-3-7 21:24):
|
|