1.5周期均线上穿150周期均线,做多;5周期均线下穿150周期均线,做空。
2.当价格低于买入价或高于卖出价1.008时止损。
3.当价格高于买入价或低于卖出价1.02时止赢。
4.当价格从买入或卖出后的最高价或最低价回撤20%时止盈。
5.每日收盘前3分钟清仓,加载在3分钟或5分钟K线。
2.当价格低于买入价或高于卖出价1.008时止损。
ma5:ma(close,5);
ma150:ma(close,150);
if cross(ma5,ma150) then
begin
sellshort(1,1,marketr);
buy(1,1,marketr);
end
if cross(ma150,ma5) then
begin
sell(1,1,marketr);
buyshort(1,1,marketr);
end
//止损
if close<enterprice*(1-0.008) and holding>0 then sell(1,holding,marketr);
if close>enterprice*(1+0.008) and holding<0 then sellshort(1,holding,marketr);
//止盈
if close>enterprice*(1+0.02) and holding>0 then sell(1,holding,marketr);
if close<enterprice*(1-0.02) and holding<0 then sellshort(1,holding,marketr);
//回撤
if close<hhv(close,enterbars)*(1-0.2) then sell(1,holding,marketr);
if close>llv(close,enterbars)*(1+0.2) then sellshort(1,holding,marketr);
if time = 150000 then
begin
sell(1,holding,marketr);
sellshort(1,holding,marketr);
end
//回撤
if close<hhv(close,enterbars+1)*(1-0.2) then sell(1,holding,marketr);
if close>llv(close,enterbars+1)*(1+0.2) then sellshort(1,holding,marketr);
回撤这类改下