初学金字塔,请各位老师挑错,日内,五分钟线,当前价格与之前两个不同周期的开盘价进行比较<!--EndFragment-->,否则卖出,并添加止损条件。
input:t(10,1,100,5),d(5);
一倍周期开盘价:=ref(open,t),noaxis,nodraw;
两倍周期开盘价:=ref(open,2*t),noaxis,nodraw;
//交易条件
开多条件:=close>ref(open,t) and close>ref(open,2*t) and time<185500;
平多条件:=time=185500 or l<enterprice-d*mindiff;
开空条件:=close<ref(open,t) and close<ref(open,2*t)and time<185500;
平空条件:=time=185500 or h>enterprice+d*mindiff;;
//交易系统
sellshort(平空条件 and holding<0,holding,market);
buy(开多条件 and holding=0,1,market);
sell(平多条件 and holding>0,holding,market);
buyshort(开空条件 and holding=0,1,market);
恳请各位好心人帮忙看看,不胜感激,
其中把止损离场和收盘前离场放在一起都用market,是不是可以? |
除了前面的close改h,close改l的
还要这样改
一个开平仓条件也是可以的,您试试
如果这么写 信号就差好多,请问这里设置的全局变量n的作用是什么
exitbars>0 这个影响的,这个导致您开平仓信号不会出现在同一根K线上
如果您要不在同一根k线开平仓,就是用原始的代码。