|
樓主 |
發表於 15-12-18 17:34
|
顯示全部樓層
編譯是沒有問題,可是 2 個語法得出來的結果不一樣.
inputs:Price(close),Len_Short(5),Len_long(60);
vars:var1(0),var2(0);
var1 = AverageFC( Price, Len_Short) ;
var2 = AverageFC( Price, Len_long ) ;
if marketposition=0 and var1 Crosses Above var2 then begin
//buy("buy") next bar at market;
buy next bar at market;
end;
if marketposition=0 and var1 Crosses Under var2 then begin
//sellshort("sellshort") next bar at market;
sellshort next bar at market;
end;
var:movsl(0);
movsl=-2000;
if PosTradeProfit(0,0)<-movsl then begin
//if PosTradeProfit(0,0)<-2000 then begin
if marketposition>0 then
sell("aaaaa") all shares next bar at market;
if marketposition<0 then
buytocover("aaaaaa") all contracts next bar at market;
end;
if marketposition<>0 then begin
//setstoploss(100*bigpointvalue);
setprofittarget(100*bigpointvalue);
end; |
|