新手請(qǐng)教老師 [金字塔]
- 咨詢內(nèi)容:
論壇上看到虧損額度控制如下,但我是新手不太好理解,怕使用時(shí)出錯(cuò),特意寫一個(gè)案例,請(qǐng)老師耐心指導(dǎo),謝謝!
variable:nn=0;variable:biaoji=0;//開倉語句中加上條件biaoji=0 if 平倉條件 and 持倉判斷 and openprofit<0 then begin平倉語句;nn:=nn+openprofit;end if openprofit<=指定額度 then 平倉語句;//平倉函數(shù)中的手?jǐn)?shù)寫0/////請(qǐng)問老師以下程序表達(dá)上有沒問題?我所在表達(dá)的意思是當(dāng)天如果虧損超過10000就不再開倉!
variable:nn=0;variable:biaoji=0;//開倉語句中加上條件biaoji=0
//開倉條件
KD:= //開多條件KK:= //開空條件
//開倉執(zhí)行
開多:BUY(KD and biaoji=0 AND HOLDING=0,2,THISCLOSE); //開多信號(hào)開空:BUYSHORT(KK and biaoji=0 AND HOLDING=0,2,THISCLOSE); //開空信號(hào)
//平多條件HH:=HHV(H,enterbars);//定義高點(diǎn),求開盤價(jià)以來的最高值,包括當(dāng)前K線LL:=LLV(L,enterbars);//定義低點(diǎn),求開盤價(jià)以來的最低值,包括當(dāng)前K線pd1:=pd2:=pd3:=pd4:=pd5:=//平空條件pk1:=pk2:=pk3:=pk4:=pk5:=
//平倉執(zhí)行
if pd1 or pd2 or pd3 or pd4 or pd5 and holding>0 then sell(1,holding,marketr);if pk1 or pk2 or pk3 or pk4 or pk5 and holding<0 then sellshort(1,holding,marketr);
if pd1 or pd2 or pd3 or pd4 or pd5 and holding>0 and openprofit<0 then begin sell(1,holding,marketr);nn:=nn+openprofit;endif pk1 or pk2 or pk3 or pk4 or pk5 and holding<0 and openprofit<0 then begin sellshort(1,holding,marketr);nn:=nn+openprofit;end
if openprofit<=-10000 then sell(1,0,market);if openprofit<=-10000 then sellshort(1,0,market);
if time>=151200 then begin //如果是股指寫成time>151200sell(holding>0,holding,marketr);sellshort(holding<0,holding,marketr);end
我的問題一,是以上表達(dá)有沒錯(cuò);二,是黃色地方是不是改為 nn;三,是如何理解biaoji在程序中的角色;四,如果第一單虧2000那么nn值是不是就是2000,biaoji的值是多少,為什么?
- 金字塔客服:
我所在表達(dá)的意思是當(dāng)天如果虧損超過10000立即平倉,并且不再開倉
- 用戶回復(fù):
那么我原來的代碼是怎么寫的?你為何要自行添加一些自己都不懂的代碼?
- 網(wǎng)友回復(fù):
就是不懂什么用才問??我加是按我理解的思路加進(jìn)去的,如果錯(cuò)了就幫我改一下???
- 網(wǎng)友回復(fù):
意思是總的虧損滿10000,當(dāng)天不再開倉?
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容