-- 作者:kedeguo
-- 发布时间:2009/11/21 22:22:28
-- 为什么文华公式改成金字塔的显示结果就不一样了呢?
请老师帮忙看一下!N:=BARSLAST(DATE<>REF(DATE,1))+1; H1:=VALUEWHEN(TIME=091300,HHV(H,N)); L1:=VALUEWHEN(TIME=091300,LLV(L,N)); HH1:=VALUEWHEN(N>30,HHV(H,30)); LL1:=VALUEWHEN(N>30,LLV(L,30)); ABK:=C>H1; ASK:=C<L1; CBK:=C>REF(HH1,1); CSK:=C<REF(LL1,1); ABK1:=IF(CROSS(C,H1),1,0); ASK1:=IF(CROSS(L1,C),1,0); CBK1:=IF(CROSS(C,REF(HH1,1)),1,0); CSK1:=IF(CROSS(REF(LL1,1),C),1,0); BBK:=IF(N<=14,0,SUM(ABK1,N-14)); BSK:=IF(N<=14,0,SUM(ASK1,N-14)); DBK:=IF(N<=31,0,SUM(CBK1,N-31)); DSK:=IF(N<=31,0,SUM(CSK1,N-31)); BK:=((ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000)) AND ( (BBK<=1 AND BSK<1 AND DSK<1)OR(DBK<=1 AND BSK<1 AND DSK<1) ) AND TIME<145700; SP:=(ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000) OR TIME>=145700; SK:=((ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000)) AND ( (BSK<=1 AND BBK<1 AND DBK<1)OR(DSK<=1 AND BBK<1 AND DBK<1) ) AND TIME<145700; BP:=(ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000) OR TIME>=145700; BUY(BK,10%,0); SELL(SP,0); BUYSHORT(SK,10%,0); SELLSHORT(BP,0);
|
-- 作者:金字塔
-- 发布时间:2009/11/21 23:12:54
--
请试一试这个
N:=BARSLAST(DATE<>REF(DATE,1))+1; H1:=VALUEWHEN(TIME=091300,HHV(H,N)); L1:=VALUEWHEN(TIME=091300,LLV(L,N)); HH1:=VALUEWHEN(N>30,HHV(H,30)); LL1:=VALUEWHEN(N>30,LLV(L,30)); ABK:=C>H1; ASK:=C<L1; CBK:=C>REF(HH1,1); CSK:=C<REF(LL1,1); ABK1:=IF(CROSS(C,H1),1,0); ASK1:=IF(CROSS(L1,C),1,0); CBK1:=IF(CROSS(C,REF(HH1,1)),1,0); CSK1:=IF(CROSS(REF(LL1,1),C),1,0); BBK:=IF(N<=14,0,SUM(ABK1,N-14)); BSK:=IF(N<=14,0,SUM(ASK1,N-14)); DBK:=IF(N<=31,0,SUM(CBK1,N-31)); DSK:=IF(N<=31,0,SUM(CSK1,N-31)); BK:=FILTER(((ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000)) AND ( (BBK<=1 AND BSK<1 AND DSK<1)OR(DBK<=1 AND BSK<1 AND DSK<1) ) AND TIME<145700 ,20 ); SP:=(ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000) OR TIME>=145700; SK:=FILTER(((ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000)) AND ( (BSK<=1 AND BBK<1 AND DBK<1)OR(DSK<=1 AND BBK<1 AND DBK<1) ) AND TIME<145700 ,20 ); BP:=(ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000) OR TIME>=145700; BUY(BK,10%,0); SELL(SP,0); BUYSHORT(SK,10%,0); SELLSHORT(BP,0);
|
-- 作者:金字塔
-- 发布时间:2009/11/22 10:55:27
--
若是符合条件以后,一天仅进行一次开平。可将代码最后4句换成下列5句,试试。
持仓:HOLDING,LINETHICK0;
SELLSHORT(BP,0);
BUY(BK AND 持仓=0,10%,0); SELL(SP,0); BUYSHORT(SK AND 持仓=0,10%,0);
|
-- 作者:金字塔
-- 发布时间:2009/11/22 16:27:11
--
那还是用这个
BK:=FILTER(((ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000)) AND ( (BBK<=1 AND BSK<1 AND DSK<1)OR(DBK<=1 AND BSK<1 AND DSK<1) ) AND TIME<145700 ,230 ); SP:=(ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000) OR TIME>=145700; SK:=FILTER(((ASK AND TIME>=091300 AND TIME<093000)OR(CSK AND TIME>=093000)) AND ( (BSK<=1 AND BBK<1 AND DBK<1)OR(DSK<=1 AND BBK<1 AND DBK<1) ) AND TIME<145700 ,230 ); BP:=(ABK AND TIME>=091300 AND TIME<093000)OR(CBK AND TIME>=093000) OR TIME>=145700;
SELLSHORT(BP,0); BUY(BK,10%,0); SELL(SP,0); BUYSHORT(SK,10%,0); 请注意最后4句的次序,逻辑上先平后开
[此贴子已经被作者于2009-11-22 16:30:02编辑过]
|