//《30分钟日内反转系统》
//使用周期30分钟图表
//Desiged by LIKALL
//
//准备需要的中间变量
h30:=ref(hhv(h,1),1);
L30:=ref(llv(l,1),1);
//画出多头的止损线
partline(holding>0,l30,colorred);
//建立多头的进场条件
long:=h>h30 and time>093000 and time<145600;
if long then
begin
sellshort(holding<0,holding,limitr,h30);
buy(holding=0,1,limitr,h30);
end
//建立空头的进场条件
short:=L<L30 and time>093000 and time<145600;
if short then
begin
sell(holding>0,0,limitr,l30);
buyshort(holding=0,1,limitr,l30);
end
//画出空头的止损线
partline(holding<0,h30,colorgreen);
//收盘前平仓
sell(time>145800 and holding>0,0,thisclose);
sellshort(time>145800 and holding<0,0,thisclose);
资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
问题补充:以上系统测试时,怎么只是开多或者开空,而没平多开空,或者平空开多的?
是那里出了问题?
在我们图表测试,显示一切正常
另外,以下的系统是用在1分钟图表上的,但这个30分钟周期是移动的,我想固定这个30分钟周期为9:00~9:30; 9:30~10:00; 10:00~10:45; 10:45~11:15; 11:15~13:45; 13:45~14:15; 14:45~15:00那下面的系统要怎么调整?
//《30分钟日内反转系统》
//使用周期1分钟图表
//Desiged by LIKALL
//
//准备需要的中间变量
h30:=ref(hhv(h,30),1);
L30:=ref(llv(l,30),1);
//画出多头的止损线
partline(holding>0,l30,colorred);
//建立多头的进场条件
long:=h>h30 and time>093000 and time<145200;
if long then
begin
sellshort(holding<0,holding,limitr,h30);
buy(holding=0,2,limitr,h30);
end
//建立空头的进场条件
short:=L<L30 and time>093000 and time<145200;
if short then
begin
sell(holding>0,0,limitr,l30);
buyshort(holding=0,2,limitr,l30);
end
//画出空头的止损线
partline(holding<0,h30,colorgreen);
//收盘前平仓
sell(time>145500 and holding>0,0,thisclose);
sellshort(time>145500 and holding<0,0,thisclose);
资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
公式在1分钟周期测试正常,恕30分钟周期太长无法测试,只要图表显示正常那么交易一定是不会有问题,如果你无法解决,那么请使用基础的ENTERLONG交易系统做你的交易语言,不要使用这种带头寸的语法。
自定义切分周期的功能 工具-》市场与板块-》双击要定义的市场-》分时周期按钮-》选中30分
另外,以下的系统是用在1分钟图表上的,但这个30分钟周期是移动的,我想固定这个30分钟周期为9:00~9:30; 9:30~10:00; 10:00~10:45; 10:45~11:15; 11:15~13:45; 13:45~14:15; 14:45~15:00那下面的系统要怎么调整? //准备需要的中间变量 //画出多头的止损线
//画出空头的止损线
|
最后的收盘前平仓为什么会提前平仓了,即14:58之前就平仓了