[原創]老師幫看下,這樣寫圖表程序對嗎? [金字塔]
- 咨詢內容:
//時間控制A1:=TIME>=0905&&TIME<1010;A2:=TIME>=1035&&TIME<1125;B1:=TIME>=1335&&TIME<1455;B2:=TIME>=2105&&TIME<2325;TT:=A1 OR A2 OR B1 OR B2; //中間條件DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);DEA:EMA(DIFF,9);C1:=BARSLAST(CROSS(DIFF,DEA))>=3;//BARSLAST函數過濾,避免短時間段內頻繁交易C2:=BARSLAST(CROSS(DEA,DIFF))>=3;//交易條件開多:=TT AND CROSS(DIFF,DEA) AND C1;開空:=TT AND CROSS(DEA,DIFF) AND C2;//交易系統BUY(開多 and HOLDING=0,1,market);//交易系統之開多操作BUYSHORT(開空 and HOLDING=0,1,market); //交易系統之開空操作
//固定止損部分************************//多頭止盈IF C-AVGENTERPRICE>8*MINDIFF THEN BEGINSELL(1,HOLDING,MARKET);END//多頭止損IF AVGENTERPRICE-C>4*MINDIFF THEN BEGINSELL(1,HOLDING,MARKET);END//空頭止盈IF AVGENTERPRICE-C>8*MINDIFF THEN BEGINSELLSHORT(1,HOLDING,MARKET);END//空頭止損IF C-AVGENTERPRICE>4*MINDIFF THEN BEGINSELLSHORT(1,HOLDING,MARKET);END//收盤前清倉**********************p2:=if(islastbar,dynainfo(207),time);if p2>=145800 thenbeginsellshort(holding<0,0,limitr,CLOSE);sell(holding>0,0,limitr,CLOSE);end//其他r1:=barslast(date<>ref(date,1));日盈虧:asset-ref(asset,r1+1),noaxis,colorred,linethick1; - 金字塔客服:
A1:=TIME>=090500&&TIME<101000;
A2:=TIME>=103500&&TIME<112500;
B1:=TIME>=133500&&TIME<145500;
B2:=TIME>=210500&&TIME<232500;
TT:=A1 OR A2 OR B1 OR B2;
//中間條件
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
C1:=BARSLAST(CROSS(DIFF,DEA))>=3;//BARSLAST函數過濾,避免短時間段內頻繁交易
C2:=BARSLAST(CROSS(DEA,DIFF))>=3;
//交易條件
開多:=TT AND CROSS(DIFF,DEA) AND ref(C1,1);
開空:=TT AND CROSS(DEA,DIFF) AND ref(C2,1);
//交易系統
BUY(開多 and HOLDING=0,1,market);//交易系統之開多操作
BUYSHORT(開空 and HOLDING=0,1,market); //交易系統之開空操作
//固定止損部分************************
//多頭止盈
IF C-AVGENTERPRICE>8*MINDIFF THEN BEGIN
SELL(1,HOLDING,MARKET);
END
//多頭止損
IF AVGENTERPRICE-C>4*MINDIFF THEN BEGIN
SELL(1,HOLDING,MARKET);
END
//空頭止盈
IF AVGENTERPRICE-C>8*MINDIFF THEN BEGIN
SELLSHORT(1,HOLDING,MARKET);
END
//空頭止損
IF C-AVGENTERPRICE>4*MINDIFF THEN BEGIN
SELLSHORT(1,HOLDING,MARKET);
END
//收盤前清倉**********************
p2:=if(islastbar,dynainfo(207),time);
if p2>=145800 then
begin
sellshort(holding<0,0,limitr,CLOSE);
sell(holding>0,0,limitr,CLOSE);
end
//其他
r1:=barslast(date<>ref(date,1));
日
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容