測(cè)試很好,看不懂,希望改成文華 [文華財(cái)經(jīng)]
-
咨詢內(nèi)容:
?
測(cè)試很好,看不懂,希望改成文華
input:inb(20,1,500,1),outb(10,1,500,1),risk(2,0,10,0.1);
variable:times=0,i=0,n=0;
rn:=ema(ref(tr,1),20);
n:=valuewhen(holding=0,rn);
rh:=ref(h,1);
rl:=ref(l,1);
h1:hhv(rh,inb);
h2:hhv(rh,outb),linedot;
l1:llv(rl,inb);
l2:llv(rl,outb),linedot;
lotst:asset*risk*0.01/(n*2*multiplier),linethick0;
lots:=if(risk=0,1,lotst); //如果risk取0,表示固定開1手
tbc:=h<>l;//判斷是否停板
partline(holding>0,enterprice-2*n);
if barpos<inb+1 then exit;
if holding=0 and tbc then //不是停板才可以交易
begin
if h>h1 then //開多
begin
buyp:=max(o,h1);
buy(1,lots,limitr,buyp);
times:=1;
while h>enterprice+n*0.5 and times<4 do
begin
buyp:=max(o,enterprice+n*0.5);
buy(1,lots,limitr,buyp);
times:=times+1;
end;//連續(xù)開倉(cāng)
end;//開多結(jié)束
else if l<l1 then //開空
begin
sellp:=min(o,l1);
buyshort(1,lots,limitr,sellp);
times:=1;
while l<enterprice-n*0.5 and times<4 do
begin
sellp:=min(o,enterprice-n*0.5);
buyshort(1,lots,limitr,sellp);
times:=times+1;
end;//連續(xù)開倉(cāng)
end;
end;//holding=0if holding>0 and tbc then //已有多倉(cāng)
begin
exitlongp:=max(enterprice-2*n,l2);
if l<exitlongp and enterbars<>0 then //出場(chǎng)
begin
exitp:=min(o,exitlongp);
sell(1,0,limitr,exitp);
times:=0;
end;//出場(chǎng)
else
begin
while h>enterprice+n*0.5 and times<4 do //開多
begin
buyp:=max(o,enterprice+n*0.5);
buy(1,lots,limitr,buyp);
times:=times+1;
end;//連續(xù)開倉(cāng)
end;//else
end;//holding>0if holding<0 and tbc then //已有空倉(cāng)
begin
exitlongp:=min(enterprice+2*n,h2);
if h>exitlongp and enterbars<>0 then //出場(chǎng)
begin
exitp:=max(o,exitlongp);
sellshort(1,0,limitr,exitp);
times:=0;
end;//出場(chǎng)
else
begin
while l<enterprice-n*0.5 and times<4 do //開多
begin
sellp:=min(o,enterprice-n*0.5);
buyshort(1,lots,limitr,sellp);
times:=times+1;
end;//連續(xù)開倉(cāng)
end;//else
end;//holding<0?
?
?來(lái)源:程序化99
-
文華技術(shù)人員:
VARIABLE:TIMES1:=0,I:=0,N:=0;
INB:=20;
OUTB:=10;
RISK:=2;
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
RN:=EMA(REF(TR,1),20);
N:=VALUEWHEN(BKVOL+SKVOL=0,RN);
RH:=REF(H,1);
RL:=REF(L,1);
H1:HHV(RH,INB);
H2:HHV(RH,OUTB),DOT;
L1:LLV(RL,INB);
L2:LLV(RL,OUTB),DOT;
LOTST:MONEYTOT*RISK*0.01/(N*2*UNIT),NODRAW;
LOTS:=IF(RISK=0,1,LOTST); //如果RISK取0,表示固定開1手
TBC:=H<>L;//判斷是否停板
PARTLINE(BKVOL>0,BKPRICE-2*N,COLORRED);IF? TBC THEN //不是停板才可以交易
BEGIN
IF H>H1 THEN //開多
BEGIN
BUYP:=MAX(O,H1);
//BUY(1,LOTS,LIMITR,BUYP);
BKVOL=0,BK(1);TIMES1:=1;
IF H>BKPRICE+N*0.5 AND TIMES1<4 THEN
BEGIN
BUYP:=MAX(O,BKPRICE+N*0.5);
BKVOL>0,BK(1);
TIMES1:=TIMES1+1;
END//連續(xù)開倉(cāng)
END//開多結(jié)束
IF L<L1 THEN //開空
BEGIN
SELLP:=MIN(O,L1);
SKVOL=0,SK(1);
TIMES1:=1;
IF L<SKPRICE-N*0.5 AND TIMES1<4 THEN
BEGIN
SELLP:=MIN(O,SKPRICE-N*0.5);
SKVOL>0,SK(1);
TIMES1:=TIMES1+1;
END//連續(xù)開倉(cāng)
END
END//HOLDING=0IF BKVOL>0 AND TBC THEN //已有多倉(cāng)
BEGIN
EXITLONGP:=MAX(BKPRICE-2*N,L2);
IF L<EXITLONGP? THEN //出場(chǎng)
BEGIN
EXITP:=MIN(O,EXITLONGP);
1,SP(BKVOL);
TIMES1:=0;
END//出場(chǎng)
END//HOLDING>0IF SKVOL>0 AND TBC THEN //已有空倉(cāng)
BEGIN
EXITLONGP:=MIN(SKPRICE+2*N,H2);
IF H>EXITLONGP THEN //出場(chǎng)
BEGIN
EXITP:=MAX(O,EXITLONGP);
1,BP(SKVOL);
TIMES1:=0;
END//出場(chǎng)
END//HOLDING<0?
?來(lái)源: www.tumamayizhan.com
-
文華客服:
?老師能改6用的嗎?用圖標(biāo)提示開倉(cāng)平倉(cāng)
?
-
網(wǎng)友回復(fù):
這是程序化模型,請(qǐng)?jiān)赪H8使用? http://cxh.wenhua.com.cn/index.asp
?
WH6是看盤軟件不支持的
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容