runmode:0;
input:length1(10,5,60,5);
input:length2(5,5,60,5);
ama:=md(close,length1);
ama1:=ema(ama,length2);
entrylongcond:=ref(cross(ama,ama1),1);
entryshortcond:=ref(cross(ama1,ama),1);
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,open);
end
if holding=0 then begin
if entryshortcond then
buyshort(1,1,limitr,open);
end
if holding>0 then begin
if entryshortcond then begin
sell(1,holding,limitr,open);
buyshort(1,1,limitr,open);
end
end
if holding<0 then begin
if entrylongcond then begin
sellshort(1,holding,limitr,open);
buy(1,1,limitr,open);
end
end
盈亏:asset-50000,noaxis,colorred,linethick2;
[此贴子已经被作者于2011-10-3 11:19:41编辑过]