判断一:
买入开仓 收盘价>=均线Ma5收盘价 买开1手
卖出开仓 收盘价<=均线Ma5收盘价 卖开1手
当判断一成功(盈利)时:
卖出平仓1手 当收盘价<=均线MA5收盘价
回到判断一
买入平仓 1手 当收盘价>=均线MA5收盘价
回到判断一
当判断一失败(亏损)时:
卖出止损: 收盘价<均线Ma5收盘价 卖出平仓1手
同时卖出开仓: 现价2手
买入平仓1手: 统计反手前之前亏损点数,当1手盈利点数=之前亏损点数
买入平仓 另1手: 当收盘价>=均线MA5收盘价
回到判断一
买入止损: 收盘价>均线Ma5收盘价 买入平仓1手
同时买入开仓: 现价2手
卖出平仓1手: 统计反手前之前亏损点数,当1手盈利点数=亏损点数
卖出平仓 另1手: 当收盘价<=均线MA5收盘价
回到判断一
没人响应啊,顶起来。继续等!
//楼主您看下
ma5:=ma(c,5);
if c>ma5 or c=ma5 then
begin
buy(holding=0,1,marketr);
end
if c<ma5 then
begin
buyshort(holding=0,1,marketr);
end
if NUMPROFIT(1)>0 and c<ma5 then sell(1,1,marketr);
if NUMPROFIT(1)>0 and c>ma5 then sellshort(1,1,marketr);
if NUMPROFIT(1)<0 and c<ma5 then
begin
sell(1,1,marketr);
buyshort(holding=0,2,marketr);
end
if NUMPROFIT(1)<0 and c>ma5 then sellshort(1,1,marketr);
if c>ma5 then
begin
sellshort(1,1,marketr);
buy(1,2,thisclose);
end
请教老师:以下的想法能实现程序化吗?
收盘价>=均线Ma5的收盘价时 买入开仓 2手: 判断条件为走完一根K线以后。
盘中当收益达到开仓价的1.05倍时, 卖出平仓1手:判断条件需要盘中固定时间间隔去检查价格变化
收盘价<均线Ma5的收盘价时 卖出平仓 余下的1手: 判断条件为走完一根K线以后。
可以,使用固定时间间隔
适当改变一下你的策略就行了,
比如:你想走完一根K线以后实现的,就使用REF(条件成立,1),间接上就已经是走完一根K线了