連續(xù)建倉(cāng)次數(shù)。現(xiàn)在滿足之后會(huì)一直建倉(cāng)
我想一次建倉(cāng)之后如果沒(méi)有平倉(cāng),再次滿足的時(shí)候就不要再建倉(cāng)了。
要怎么寫(xiě)或者怎么設(shè)置呢
variable:n=0;
if n=0 and 開(kāi)倉(cāng)條件 then begin
buy(1,1,market);
n:=1;
end
if 平倉(cāng)條件 and n=1 and holding>0 then begin
sell(1,1,market);
n:=0;
end
這個(gè)是用全局變量來(lái)限定的,=0表示已經(jīng)平過(guò)倉(cāng),可以繼續(xù)開(kāi)倉(cāng),=1表示還沒(méi)有平倉(cāng),所以不再建倉(cāng)
這樣可以了
但是測(cè)試的時(shí)候還是按照100股幫我測(cè)試的,要怎么解決呢?
variable:n=0;
if n=0 and 開(kāi)倉(cāng)條件 then begin
buy(1,1,market);
n:=1;
end
if 平倉(cāng)條件 and n=1 and holding>0 then begin
sell(1,1,market);
n:=0;
end
這個(gè)是用全局變量來(lái)限定的,=0表示已經(jīng)平過(guò)倉(cāng),可以繼續(xù)開(kāi)倉(cāng),=1表示還沒(méi)有平倉(cāng),所以不再建倉(cāng)
這樣可以了
但是測(cè)試的時(shí)候還是按照100股幫我測(cè)試的,要怎么解決呢?