我編了一個程序,但和我的想法不一,請看看 [金字塔]
- 咨詢內容:
//本策略主要是整合了網上的一些方法,我主要是想做日內單邊上漲或下跌,加載在一分鐘周期上,用走完k線模式。
1.開多條件是:5日線和10日線多頭排列時,10點前漲幅超過0.5%,在time>=100000 and time<=143000時,如果再次突破10點前高點,在下一根k線做多;反之,做空。
2.平倉分收盤平倉,止損平倉,止盈平倉。止損點為10個指數點;止盈條件為當盈利超過10個指數點后,如回撤幅度達到50%,就平倉,并且當日不再開倉。
3.現在的問題是信號沒有,比如今天可以開倉的,但沒有信號
INPUT:跌幅(0.005,0.001,0.025,0.001);
INPUT:止損(50,10,100,1);
INPUT:時間(60,30,120,10);
INPUT:回撤(0.5,0.1,1,0.1);
VARIABLE:aa:=0;//判斷開倉的次數,如果止盈平倉,就不再開倉
昨收:=ref(c,todaybar);
10點前最高價:=valuewhen(todaybar<=45,hhv(h,todaybar));
10點前最低價:=valuewhen(todaybar<=45,llv(l,todaybar));
10點前漲幅:=(10點前最高價-昨收)/昨收;
10點前跌幅:=(昨收-10點前最低價)/昨收;
開倉時間:=time>=100000 and time<=143000;
收盤平倉時間:=time>145500;
多頭止損價:=enterprice-止損*mindiff;
空頭止損價:=enterprice+止損*mindiff;
開倉后最高:=hhv(h,enterbars+1);
開倉后最低:=llv(l,enterbars+1);
開多倉后最高盈利:=開倉后最高-enterprice;
開空倉后最高盈利:=enterprice-開倉后最低;
多倉當前盈利:=c-enterprice;
空倉當前盈利:=enterprice-c;
//交易條件
多倉條件:=10點前漲幅>=漲幅 and 開倉時間 and ref(c,1)>=10點前最高價 and holding=0 and aa=0;
空倉條件:=10點前跌幅>=跌幅 and 開倉時間 and ref(c,1)<=10點前最低價 and holding=0 and aa=0;
//交易系統
//收盤平倉
if 收盤平倉時間 and holding<>0 then begin
平多:sell(1,holding,limit,o);
平空:sellshort(1,holding,limit,o);
aa:=0;
end
//止損平倉
if holding>0 and ref(c,1)<=多頭止損價 then begin
止損價格:=多頭止損價;
if o<止損價格 then begin
止損價格:=o;
止損平多:sell(1,holding,limit,止損價格);
aa:=0;
end;
end;
if holding<0 and ref(c,1)>=空頭止損價 then begin
止損價格:=空頭止損價;
if o>止損價格 then begin
止損價格:=o;
止損平空:sellshort(1,holding,limit,止損價格);
aa:=0;
end;
end;
//止盈平倉
if holding>0 and 開多倉后最高盈利>=50*mindiff and 多倉當前盈利<=回撤*開多倉后最高盈利 and enterbars>0 and aa=0 then begin
止盈平多:sell(1,holding,limit,o);
aa:=1;
if time=closetime(0)then begin
aa:=0;
end;
end;
if holding<0 and 開空倉后最高盈利>=50*mindiff and 空倉當前盈利<=回撤*開空倉后最高盈利 and enterbars>0 and aa=0 then begin
止盈平空:sellshort(1,holding,limit,o);
aa:=1;
if time=closetime(0)then begin
aa:=0;
end;
end;
//開倉
buy(多倉條件=1,1,limit,o);
sell(空倉條件=1,1,limit,o);
- 金字塔客服:
漲幅和跌幅是怎么定義的?
- 用戶回復:
NPUT:跌幅(0.005,0.001,0.025,0.001);
- 網友回復:
漲幅忘了
- 網友回復: 加了還是不行
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容