代碼問題 [金字塔]
- 咨詢內容:
請教:下面這段代碼前面那兩句平倉代碼是什么意思,為什么一旦出現平倉后,后面即使條件成立當天也不會再有開倉了呢?
variable:a1=1;
tn:=1;//交易手數
cx:=1;//最大持倉量
xd:=3;//提前下單量(秒)
//交易時間區間
p1:=time>091500 and time<150000;
p2:=if(islastbar,dynainfo(207),time);
p3:=time0-timetot0(p2),linethick0;r1:=barslast(date<>ref(date,1));
r2:=ref(o,r1);hd:=if(islastbar,8,2.0);
hd1:=if(islastbar,3,0.2);r10:=ref(asset,r1+1);
if r10-asset>3000 then a1:=-1;
if asset-r10>2000 then a1:=-1;
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,25);if a1<0 and p3<=xd then
begin
sell(1,tn,limitr,c-hd1);
sellshort(1,tn,limitr,c+hd1);
end//*******************************
if cross(ma1,ma2) and a1>0 and p1 and p3<=xd then
begin
sellshort(holding<0,tn,limitr,c+hd1);
buy(holding=0,tn,limitr,c+hd1);
endif cross(ma2,ma1) and a1>0 and p1 and p3<=xd then
begin
sell(holding>0,tn,limitr,c-hd1);
buyshort(holding=0,tn,limitr,c-hd1);
end
//**********收盤前清倉***********
if p2>=151000 then
begin
sellshort(holding<0,abs(holding),limitr,c+hd1);
sell(holding>0,holding,limitr,c-hd1);
a1:=1;
end - 金字塔客服:
不是最后兩句導致不再開倉,而是P1的時間限定住了開倉時間
- 用戶回復:
老師,那個P1的意思我知道,我是看不明白下面這幾句代碼的意思,為什么有時早盤出現平倉后,全天也不會開單了呢?if a1<0 and p3<=xd thenbegin
sell(1,tn,limitr,c-hd1);
sellshort(1,tn,limitr,c+hd1);
end - 網友回復:
那是因為有A1作為判斷,當日虧損超過3000或者盈利超過2000之后,A1這個標志就置為-1,而開倉需要A1>0
- 網友回復: 意思明白了,這個代碼對實盤交易有效嗎?
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容