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