EasyTrader ArtNo 082
CDP 逆勢操作系統,主要是應用在短線進出的操作上,它藉由前一日的價位數據,在橫座標上,估畫出可供當日進行短線操作參考的五條橫線來,然後依據當日的開盤價位的位置狀況,進行當日盤中買賣沖銷的短線操作。CDP系統在計算時,首先以前一日行情的平均價值(即需求值CDP)及高低價的振盪波幅,來估算出今日的極高價AH、極低價AL及近高價NH、近低價NL等四個參考值來,依此再與今日的盤中走勢行情搭配分析,來判斷今日行情走勢的強弱度,作為短線進出的依據。
在依前一日行情畫出五條參考橫線後,應用CDP時首先觀察當日的開盤情形,當開盤價開在AH或AL附近時,顯示行情為跳空開出,可能是一個大行情的開始,因此可以在AH或AL的價位值去追買或追賣。而若開盤開在CDP值附近,即NH與NL之間時,表示當日行情的波動幅度可能不大,可以在價格突出NH值時作賣出,而在跌落NL值時作買進動作。使用CDP作短線操作進出時,記得在當日平倉沖銷掉。
全文網址: MoneyDJ 財經知識庫
CDP值可以是 (High+Low+2*Close)/4 ,也可以是 (High+Low+Close)/3
當沖策略程式碼 - CDP
input:stoploss(0.005),TimeEntry(900),TimeExit(1230),TimeFlat(1335),tradeprofit(0.03),HLrange(75)
,RangeVol(3),TrendVol(0.3);
vars:cdp(0),ah(0),nh(0),nl(0),al(0),HL(0);
vars: MP(0),IsBalanceDay(false),PF(0),PL(0),KB(0),KS(0),DayHigh(99999),DayLow(0) ;
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
if date<>date[1] then begin
HL = 0 ;
HL = highD(1) - LowD(1) ;
cdp = (highD(1)+LowD(1)+2*CloseD(1))/4;
ah = cdp+(highD(1) - LowD(1));
nh = cdp*2 - LowD(1);
nl = cdp*2 - highD(1);
al = cdp - (highD(1) - LowD(1));
KB = 0 ;
KS = 0 ;
end ;
{ HighLow Trigger }
if time=TimeExit then begin
DayHigh= MaxList(HighD(0),HighD(1),HighD(2),HighD(3));
DayLow= MinList(LowD(0),LowD(1),LowD(2));
end;
{ Entry Rule}
if time > TimeEntry then begin
if MP <=0 and KB = 0 and high > DayHigh and Close > Close[RangeVol] then begin
Buy next bar at ah stop;
end;
if MP >= 0 and KS =0 and low < DayLow and Close < Close[RangeVol] then begin
Sell next bar at al stop;
end;
end;
{ Exit Rule }
if MP = 1 then begin
KB = 1;
exitlong next bar at nh stop ;
end;
if MP = -1 then begin
KS = 1;
exitshort next bar at nl stop;
end;
if MP > 0 then begin
exitlong next bar at entryprice-stoploss*10000 stop;
end;
if MP < 0 then begin
exitshort next bar at entryprice + stoploss*10000 stop;
end;
if time = TimeFlat then begin
exitlong on close;
exitshort on close;
cdp = 0;
ah = 0;
nh = 0;
nl = 0;
al = 0;
DayHigh = 99999 ;
DayLow = 0 ;
end;
SetExitOnClose;
基本設定 台指期 5分K 日內交易 ,回測週期 2001/1~2013/10/31 交易成本 1200
近幾年的績效表現不佳,那麼加上如意多空網是否有改善呢 ?
當沖策略主程式碼 - CDP +如意多空網
if time=TimeExit then begin
DayHigh= MaxList(HighD(0),HighD(1){,HighD(2),HighD(3)});
DayLow= MinList(LowD(0),LowD(1){,LowD(2)});
end;
if time > TimeEntry then begin
if MP <=0 and KB = 0 and high > DayHigh and Close > Close[RangeVol]
and _MagicQF001(1) > 0 then begin Buy next bar at ah {(ah+nh)/2} stop;
end;
if MP >= 0 and KS =0 and low < DayLow and Close < Close[RangeVol]
end;
if MP >= 0 and KS =0 and low < DayLow and Close < Close[RangeVol]
"而若開盤開在CDP值附近,即NH與NL之間時,表示當日行情的波動幅度可能不大,可以在價格突出NH值時作賣出,而在跌落NL值時作買進動作"
回覆刪除請問上述這段逆勢的程式語法應該如何實現呢?
1. 開在 Cdp 附近可以用 OpenD(0) < NH and OpenD(0) > NL ,或是作多只用 OpenD(0) < NH ,作空只用 OpenD(0) > NL
回覆刪除2.突破 NH 賣出 ( 但不能過 AH ) 所以就 if Close {High} < AH + 上面條件 then Sell next bar at NH Limit ;
3.跌破 NL 買入 ( 但不能破 AL) 所以就 if Close {Low} > AL + + 上面條件 then Buy next bar at NL Limit ;
4.其他濾網就自己處理囉