求助:我是图表交易 下面的条件如何编写!万分感谢
##写成反手系统##平多就是开空条件;平空就是开多条件;
均线:=MA(Close,20);
-------------------------------------------------------------------------
当K棒high>均线 and open<均线 -----用限价limitr 均线值 开多
当K棒high>均线 and open>=均线-----用市价marketr 开多
=======================================
当K棒low<均线 and open>均线 -----用限价limitr 均线值 开空
当K棒low<均线 and open<=均线-----用市价marketr 开空
防止本周期均线会变动;均线用 REF(均线,1)
没有人会吗
没有人会吗
您的金币自己留着吧,不用给我了
//图表程序化交易
ss:=1;
ma20:=ref(ma(c,20),1);
jg:=ma20/mindiff*mindiff;
//平空开多
if high>ma20 then
begin
if open>=ma20 then
begin
sellshort(holding<0,ss,marketr);
buy(holding=0,ss,marketr);
end
else
begin
sellshort(holding<0,ss,marketr);
buy(holding=0,ss,limitr,jg+mindiff);
end
end
//平多开空
if low<ma20 then
begin
if open<=ma20 then
begin
sell(holding>0,ss,marketr);
buyshort(holding=0,ss,marketr);
end
else
begin
sell(holding>0,ss,marketr);
buyshort(holding=0,ss,limitr,jg-mindiff);
end
end
万分感谢