新手請問停損一次就不在進場,應該如何用程式表達
請問停損一次就不在進場,應該如何用程式表達,比如二均策略,我該加些什麼If time >= 0845 and time <= 1300
and marketposition = 0 then begin
If value1 cross over value2 then buy next bar at open;
If value1 cross under value2 then sellshort next bar at open;
End;
if marketposition <> 0 then begin
setstoploss(200*loss);
end;
If Time > 1300 then begin
sell next bar at open;
buytocover next bar at open;
End; TS 區應該很多,請多爬文.....有次數的.也有虧多少錢的.... 本帖最後由 titl 於 11-7-26 06:10 PM 編輯
一個簡單的方法,加一個參數去分辦!設a=false是停損過,要計算次數,就改為計數也可以,停損一次可以如下寫法:
========================================
If time >= 0845 and time <= 1300 and marketposition = 0 and a then begin
If value1 cross over value2 then buy next bar at open;
If value1 cross under value2 then sellshort next bar at open;
End;
if marketposition <> 0 then begin
setstoploss(200*loss);
a=false;
end;
If Time > 1300 then begin
sell next bar at open;
buytocover next bar at open;
a=true;
End;
頁:
[1]