老师好?
分时图中有分时线和结算线,一根是白的的一根是黄的。
我想把分时线上穿结算线,做多。止损为下穿5个点平仓;止盈价格为收盘前平仓(最好是在14:55分前平仓);
分时线下穿结算线,做空。止损为上穿5个点平仓;止盈价格为收盘前平仓(最好是在14:55分前平仓);
以上的公式如何写?
n1:=todaybar;
dm:=4-INTPART(LOG(C));
jsj:=ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm);
cc:=c;
if cross(cc,jsj) then begin
buy(holding=0,1,marketr);
end
if cross(jsj,cc) then begin
buyshort(holding=0,1,marketr);
end
if c<jsj-5 then sell(1,0,marketr);
if c>jsj+5 then sellshort(1,0,marketr);
if time0>=timetot0(closetime(0))-5*60 then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end