本帖最后由 金字塔客服 于 2011-12-9 16:54 编辑
基于 金字塔 平台编写的一些经典交易系统案例
(金字塔z7c9版主原创 )
--------------------------------------
分形通道突破
runmode:0;
sfx:=ref(high,1)<ref(high,2) and ref(high,2)>ref(high,3);
xfx:= ref(low,1)>ref(low,2) and ref(low,2)<ref(low,3);
upperband:=valuewhen(sfx,ref(high,2));
lowerband:=valuewhen(xfx,ref(low,2));
exittime:=time>=150000;
if holding=0 then begin
if high>=upperband then
buy(1,1,limitr,max(open,upperband));
end
if holding=0 then begin
if low<=lowerband then
buyshort(1,1,limitr,min(open,lowerband));
end
if holding>0 then begin
if time>=150000 then
sell(1,holding,limitr,close);
end
if holding<0 then begin
if time>=150000 then
sellshort(1,holding,limitr,close);
end
盈亏:asset-50000,noaxis,colorred,linethick2;
--------------------------------
考夫曼自适应移动均线系统
runmode:0;
input:length1(10,5,60,5);
input:length2(5,5,60,5);
ama:=md(close,length1);
ama1:=ema(ama,length2);
entrylongcond:=ref(cross(ama,ama1),1);
entryshortcond:=ref(cross(ama1,ama),1);
if holding=0 then begin
if entrylongcond then
buy(1,1,limitr,open);
end
if holding=0 then begin
if entryshortcond then
buyshort(1,1,limitr,open);
end
if holding>0 then begin
if entryshortcond then begin
sell(1,holding,limitr,open);
buyshort(1,1,limitr,open);
end
end
if holding<0 then begin
if entrylongcond then begin
sellshort(1,holding,limitr,open);
buy(1,1,limitr,open);
end
end
盈亏:asset-50000,noaxis,colorred,linethick2;
--------------------------------
鳄鱼线与分形图
1 Y:=(H+L)/2;
2 AA:=REF((SMA(Y,5,1)),3);
3 BB:=REF((SMA(Y,8,1)),5);
4 CC:=REF((SMA(Y,13,1)),8);
5 MA1:=MA(CLOSE,5),COLORWHITE,LINETHICK3;
6 MA2:=MA(CLOSE,10),COLORYELLOW,LINETHICK3;
7 MA3:=MA(CLOSE,30),COLORDB7093,LINETHICK3;
8 鳄:CC,COLORFF6600;
9 齿:BB,COLORRED;
10 唇:AA,COLORGREEN;
11 R2:=REF(齿,5);
12 KU1:=IF(HIGH=HHV(HIGH,3),1,0);
13 KD1:=IF(LOW=LLV(LOW,3),1,0);
14 UL:=IF(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0)));
15 DL:=IF(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0)));
16 上分形:IF(HIGH>=R2,UL,REF(UL,BARSLAST(HIGH>R2))),POINTDOT,LINETHICK3,COLORMAGENTA;
17 下分形:IF(LOW<=R2,DL,REF(DL,BARSLAST(LOW<=R2))),POINTDOT,LINETHICK3,COLORYELLOW;
18
19 AO:=MA(Y,5)-MA(Y,34);
20 MAO:=MA(AO,5);
21 AC:=AO-MAO;
22 AC1:=REF(AC,1);
23 AO1:=REF(AO,1);
24 KAC:=IF(AC>AC1 AND AO>AO1,1,0);
25 KAO:=IF(AC<AC1 AND AO<AO1,-1,0);
26 STICKLINE(KAC=1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORRED;
27 STICKLINE(KAO=-1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORGREEN;
28 STICKLINE(KAO=0 AND KAC=0 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORDDDDDD;
29 STICKLINE(CLOSE>=OPEN,HIGH,CLOSE,0.0,1.0),COLORRED;
30 STICKLINE(CLOSE>=OPEN,OPEN,LOW,0.0,1),COLORRED;
31 STICKLINE(KAC=1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORRED;
32 STICKLINE(KAO=-1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORGREEN;
------------------------------------
|