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