平倉(cāng)信號(hào)出來(lái)后隔2根K線再啟動(dòng)開倉(cāng)條件怎么寫? [金字塔]
- 咨詢內(nèi)容:
buycondition:=c>ma(c,20);
sellcondition:=c<ma(c,20);
buycond:=cross(ma(c,5),ma(c,10));
sellcond:=cross(ma(c,10),ma(c,5));
if holding>0 and c<enterprice-20 then sell(1,1,limitr,c);
if holding<0 and c>enterprice+20 then sellshort(1,1,limitr,c);
if holding>0 and sellcondition then sell(1,1,limitr,c);
if holding<0 and buycondition then sellshort(1,1,limitr,c);
if holding>0 and sellcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond then buy(1,1,limitr,c);
if holding=0 and sellcond then buyshort(1,1,limitr,c);
問(wèn)題:
多單平倉(cāng)后(多種平倉(cāng)策略)如果滿足做空條件,不馬上做空,而是等過(guò)2根K線之后,滿足做空條件則做空
空單平倉(cāng)后(多種平倉(cāng)策略)如果滿足做多條件,不馬上做多,而是等過(guò)2跟K先之后,滿足做多條件則做多
以上思路如何實(shí)現(xiàn)?
- 金字塔客服:
參考
得到當(dāng)前位置之前上N次信號(hào)指定類型距當(dāng)前周期
[此貼子已經(jīng)被作者于2012-1-16 8:46:54編輯過(guò)]
用法:
TYPEBAR(N,TYPE)N表示上次信號(hào),
TYPE表示信號(hào)類型 0、無(wú)信號(hào)1、開多2、平多3、開空;4、平空
例如:TYPEBAR(2,1)表示:倒數(shù)第2個(gè)開多信號(hào)歷時(shí)
該函數(shù)僅在逐K線計(jì)算模式下有效, 并且只能用在BUY,SELL等新圖表交易系統(tǒng)中,不能與舊圖表交易系統(tǒng)ENTERLONG,EXITLONG等混用。
所屬函數(shù)組:交易系統(tǒng) - 用戶回復(fù):
單獨(dú)在開多語(yǔ)句中加入 typebar(1,4)>2 或者在開空語(yǔ)句中加入typebar(1,2)>2 信號(hào)都能正常顯示。可是在開多和開空語(yǔ)句中同時(shí)加入條件后,信號(hào)都消失了,這是為什么?
- 網(wǎng)友回復(fù):
估計(jì)是您使用有誤,直接把代碼貼出來(lái)看看--附帶簡(jiǎn)要文字說(shuō)明
- 網(wǎng)友回復(fù):
buycondition:=c>ma(c,20);
sellcondition:=c<ma(c,20);
buycond:=cross(ma(c,5),ma(c,10));
sellcond:=cross(ma(c,10),ma(c,5));
if holding>0 and c<enterprice-20 then sell(1,1,limitr,c);
if holding<0 and c>enterprice+20 then sellshort(1,1,limitr,c);
if holding>0 and sellcondition then sell(1,1,limitr,c);
if holding<0 and buycondition then sellshort(1,1,limitr,c);
if holding>0 and sellcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond and typebar(1,4)>2 then buy(1,1,limitr,c);
if holding=0 and sellcond and typebar(1,2)>2 then buyshort(1,1,limitr,c);
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容