求助 [金字塔]
- 咨詢內(nèi)容:
請幫忙寫一個模型,思路如下:5分鐘,10分鐘,15分鐘,當3個周期的5均線分別全部上穿10均線時平空開多(全部處于金叉之中,可以是在不同時間陸續(xù)上穿,當3個周期全部滿足條件時平倉開倉)。5分鐘,10分鐘,15分鐘,當3個周期的5均線分別全部下穿10均線時平多開空(全部處于死叉之中,可以是在不同時間陸續(xù)下穿,當3個周期全部滿足條件時平倉開倉) 。
- 金字塔客服:
不同時上穿的話,可以理解成3個周期的5均線皆大于10均線
后面的都可以同理,三個周期判斷5均線是否大于10均線,全部滿足條件后開平倉
[此貼子已經(jīng)被作者于2013-3-8 13:25:23編輯過] - 用戶回復(fù):
但上穿下穿可能比大于小于的條件信號會更穩(wěn)定一些。 請老師幫我編寫一下,謝謝!
- 網(wǎng)友回復(fù):
ma5_5:=stkindi(STKLABEL,'ma.ma1',0,2);
ma5_10:=stkindi(STKLABEL,'ma.ma1',0,18);
ma5_15:=stkindi(STKLABEL,'ma.ma1',0,3);ma10_5:=stkindi(STKLABEL,'ma.ma2',0,2);
ma10_10:=stkindi(STKLABEL,'ma.ma2',0,18);
ma10_15:=stkindi(STKLABEL,'ma.ma2',0,3);//引用,由于系統(tǒng)自帶的ma公式里面有5周期和10周期均線了,所以直接引用。在ma公式中,ma1是5周期,ma2是10周期
variable:n1=0,n2=0,n3=0;
variable:m1=0,m2=0,m3=0;if cross(ma5_5,ma10_5) then n1:=1;
if cross(ma5_10,ma10_10) then n2:=1;
if cross(ma5_15,ma10_15) then n3:=1;
if cross(ma10_5,ma5_5) then m1:=1;
if cross(ma10_10,ma5_10) then m2:=1;
if cross(ma10_15,ma5_15) then m3:=1;
//全局變量n和m系列,用于記錄上下穿的狀態(tài),為1是表示上穿,為0時表示還未上傳或者是平倉之后沒有上穿
if n1=1 and n2=1 and n3=1 then begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
n1:=0;
n2:=0;
n3:=0;
endif m1=1 and m2=1 and m3=1 then begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
m1:=0;
m2:=0;
m3:=0;
end
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 262069696 進行 有償 編寫!(不貴!點擊查看價格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容