-- 作者:jinzhe
-- 发布时间:2015/10/19 11:18:48
--
ma5:ma(c,5);
if ma5>ref(ma5,1) then begin
sellshort(1,0,thisclose);
buy(holding=0,1,thisclose);
end
if ma5<ref(ma5,1) then begin
sell(1,0,thisclose);
buyshort(holding=0,1,thisclose);
end
避免频繁开多:设定交易模式为走完k线,在交易---图表程式化交易 进行设置
|
-- 作者:青风
-- 发布时间:2015/10/19 11:47:57
--
谢谢。
但您的这个程序是5日均向上时平空做多,5日均向下时平多做空。这种情况如果在小周期里,比如一分钟周期,很有可能做多后,几分钟后5日均就已经拐头向下了。
我的构思是当5日均由向下转为向上时平空做多,5日均由向上转为向下时平多做空。也就是说,我想在均线拐头的时候介入,而不是已经拐头后的过程中才介入。
如果是在小周期里使用此程序,即使设为走完K线模式,也不能避免频繁开仓。比如还是在一分钟周期里,如果是在横盘震荡,那么5日均很有可能在短短的数十分钟里频繁的拐头向上、拐头向下……如此一来就造成了频繁开仓……
[此贴子已经被作者于2015/10/19 11:49:10编辑过]
|
-- 作者:jinzhe
-- 发布时间:2015/10/19 13:09:51
--
if ma5>ref(ma5,1) and ref(ma5,1) <ref(ma5,2) then begin
sellshort(1,0,thisclose);
buy(holding=0,1,thisclose);
end
if ma5<ref(ma5,1) and ref(ma5,1)>ref(ma5,2) then begin
sell(1,0,thisclose);
buyshort(holding=0,1,thisclose);
end
这个是我定义的一个简单拐头,如果用户还认为不满意,那么只能请用户自行定义了
|