請問日內交易,虧損達到1萬就止損不再交易怎么寫?
作者:金字塔 來源:cxh99.com 發布時間:2015年10月20日
- 咨詢內容:
請問日內交易,虧損達到1萬就止損不再交易怎么寫?謝謝
- 金字塔客服:
//多頭為例
VARIABLE:a=0,n=0;
if date<>ref(date,1) then BEGIN
a:=asset;
n:=0;
end
if 開倉條件 and n=0 then buy(holding=0,1,market);
if a-asset>=10000 then begin
sell(holding>0,holding,market);
n:=1;
end
[此貼子已經被作者于2014/11/24 16:14:09編輯過]
- 用戶回復:
r1:=barslast(date<>ref(date,1));if r1=0 then n1:=1;
if ref(asset,r1+1)-asset>10000 thenbeginsell(1,0,limitr,c);sellshort(1,0,limitr,c);n1:=-1;end//在開倉條件中加n1>0