input:nprofit(400),npercentage(33),amount(0.045);
value2=(maxpositionprofit/bigpointvalue);
value3=entryprice*(1-amount);
VARS:LEN1(10),LEN2(20),LEN3(200);
VARS:MA1(0),ma2(0),ma3(0);
IF MA1 cross over ma2 then BUY NEXT BAR AT MARKET;
IF marketposition=1 and value2>=nprofit then begin
sell("buypercenttrainng") next bar entryprice + value2 - value2*npercentage/100 stop ;
end;
var:LastTradingDay(false);
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)=3 then begin
LastTradingDay=True;
end else begin
LastTradingDay=False;
end;
if LastTradingDay then begin
if sessionlastbar then begin
if marketposition>0 then buy next bar at market;
if marketposition<0 then sellshort next bar at market;
end;
setexitonclose;
end;
各位前輩好,小弟有一個問題想請教,我這語法是結算日自然結算完,隔日延續倉為再進場,但那個停利的語法每次結算完都會直接在出現在同一根進場的K棒,在不是結算日的停利出場都是正常的,還有一個問題是如何追蹤結算日前持倉的進場價位,作為後續再進場的停利點為判斷呢??
|