請問 PosTradeProfit(0,0)< - 變量 不可以使用?
請問 PosTradeProfit(0,0)< - 變量 怎麼不可以使用? 哪邊寫錯了嗎?var:movsl(0);
movsl=-2000;
if PosTradeProfit(0,0)<-movsl then begin
if marketposition>0then
sell("aaaaa") all shares next bar at market;
if marketposition<0then
buytocover("aaaaaa") all contracts next bar at market;
end;
看起來,編譯是沒有問題的。
不會不能用吧。
編譯是沒有問題,可是 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 andvar1Crosses Abovevar2 then begin
//buy("buy") next bar at market;
buy next bar at market;
end;
if marketposition=0 andvar1 Crosses Undervar2 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>0then
sell("aaaaa") all shares next bar at market;
if marketposition<0then
buytocover("aaaaaa") all contracts next bar at market;
end;
if marketposition<>0 then begin
//setstoploss(100*bigpointvalue);
setprofittarget(100*bigpointvalue);
end; 沒問題了~ 多加了一個 - 在上面
算我白癡~
謝謝 政哥~
頁:
[1]