如何加倉(cāng)循環(huán)
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2015年07月02日
- 咨詢內(nèi)容:
1、初始第一次開倉(cāng)為1手,當(dāng)?shù)谝淮伍_倉(cāng)虧損時(shí),第二次開倉(cāng)數(shù)量為2手,繼續(xù)虧損時(shí),以此類推。2、如果第一次開倉(cāng)盈利,接下來(lái)的開倉(cāng),依然是1手,如果前面虧損好幾次了,這次盈利后,又回到開倉(cāng)為1手。請(qǐng)問,這樣的開倉(cāng),要怎么用程序表達(dá)?
請(qǐng)高手幫忙!謝謝!
- 金字塔客服:
variable:n=1;
if 開倉(cāng)條件 and 持倉(cāng)判斷 then begin
開倉(cāng)語(yǔ)句;
if numprofit(1)>0 then n:=1;
if numprofit(1)<0 then n:=n*2;
end
- 用戶回復(fù):
numprofit(1)這個(gè)是取上一次的盈虧,如果我連續(xù)5次虧損,我開倉(cāng)數(shù)量就是6手了,你的表達(dá)方式就不對(duì)了
- 網(wǎng)友回復(fù):
是遞加不是翻倍?
改這里就行
variable:n=1;
if 開倉(cāng)條件 and 持倉(cāng)判斷 then begin
開倉(cāng)語(yǔ)句;
if numprofit(1)>0 then n:=1;
if numprofit(1)<0 then n:=n+1;
end
連虧也是這樣寫,你想想看這個(gè)思路,能理解最好