相关标签:
虚拟期货5档行情源代码
金字塔公式 金字塔模型策略源码:
1 variable:askprice2=0,askvol2=0,bidprice2=0,bidvol2=0;
2 variable:askprice3=0,askvol3=0,bidprice3=0,bidvol3=0;
3 variable:askprice4=0,askvol4=0,bidprice4=0,bidvol4=0;
4 variable:askprice5=0,askvol5=0,bidprice5=0,bidvol5=0;
5 variable:askprice6=0,askvol6=0,bidprice6=0,bidvol6=0;
6
7
8
9 refaskprice:=ref(askprice,1);
10 refaskvol:=ref(askvol,1);
11 refbidprice:=ref(bidprice,1);
12 refbidvol:=ref(bidvol,1);
13
14 if askprice<refaskprice then begin
15 askprice6:=askprice5;
16 askvol6:=askvol5;
17 askprice5:=askprice4;
18 askvol5:=askvol4;
19 askprice4:=askprice3;
20 askvol4:=askvol3;
21 askprice3:=askprice2;
22 askvol3:=askvol2;
23 askprice2:=refaskprice;
24 askvol2:=refaskvol;
25 end;
26
27 if askprice>refaskprice then begin
28 askprice2:=askprice3;
29 askvol2:=askvol3;
30 askprice3:=askprice4;
31 askvol3:=askvol4;
32 askprice4:=askprice5;
33 askvol4:=askvol5;
34 askprice5:=askprice6;
35 askvol5:=askvol6;
36 end;
37
38 if bidprice>refbidprice then begin
39 bidprice6:=bidprice5;
40 bidvol6:=bidvol5;
41 bidprice5:=bidprice4;
42 bidvol5:=bidvol4;
43 bidprice4:=bidprice3;
44 bidvol4:=bidvol3;
45 bidprice3:=bidprice2;
46 bidvol3:=bidvol2;
47 bidprice2:=refbidprice;
48 bidvol2:=refbidvol;
49 end;
50
51 if bidprice<refbidprice then begin
52 bidprice2:=bidprice3;
53 bidvol2:=bidvol3;
54 bidprice3:=bidprice4;
55 bidvol3:=bidvol4;
56 bidprice4:=bidprice5;
57 bidvol4:=bidvol5;
58 bidprice5:=bidprice6;
59 bidvol5:=bidvol6;
60 end;
61
62 x1:=900;
63 x2:=970;
64 y1:=75;
65 y2:=25;
66
67 n:=0;
68
69 drawtextex(1,1,x1,0,\'--------------------\',colorgreen);
70
71 drawtextex(1,1,x1,25,\'卖五 \'+numtostr(askprice5,n),colorwhite);
72 drawtextex(1,1,x2,25,numtostr(askvol5,0),coloryellow);
73
74 drawtextex(1,1,x1,50,\'--------------------\',colorgreen);
75
76 drawtextex(1,1,x1,75,\'卖四 \'+numtostr(askprice4,n),colorwhite);
77 drawtextex(1,1,x2,75,numtostr(askvol4,0),coloryellow);
78
79 drawtextex(1,1,x1,100,\'--------------------\',colorgreen);
80
81 drawtextex(1,1,x1,125,\'卖三 \'+numtostr(askprice3,n),colorwhite);
82 drawtextex(1,1,x2,125,numtostr(askvol3,0),coloryellow);
83
84 drawtextex(1,1,x1,150,\'--------------------\',colorgreen);
85
86 drawtextex(1,1,x1,175,\'卖二 \'+numtostr(askprice2,n),colorwhite);
87 drawtextex(1,1,x2,175,numtostr(askvol2,0),coloryellow);
88
89 drawtextex(1,1,x1,200,\'--------------------\',colorgreen);
90
91 drawtextex(1,1,x1,225,\'卖一 \'+numtostr(askprice,n),colorwhite);
92 drawtextex(1,1,x2,225,numtostr(askvol,0),coloryellow);
93
94 drawtextex(1,1,x1,250,\'--------------------\',colorred);
95
96 drawtextex(1,1,x1,275,\'买一 \'+numtostr(bidprice,n),colorwhite);
97 drawtextex(1,1,x2,275,numtostr(bidvol,0),coloryellow);
98
99 drawtextex(1,1,x1,300,\'--------------------\',colorgreen);
100
101 drawtextex(1,1,x1,325,\'买二 \'+numtostr(bidprice2,n),colorwhite);
102 drawtextex(1,1,x2,325,numtostr(bidvol2,0),coloryellow);
103
104 drawtextex(1,1,x1,350,\'--------------------\',colorgreen);
105
106 drawtextex(1,1,x1,375,\'买三 \'+numtostr(bidprice3,n),colorwhite);
107 drawtextex(1,1,x2,375,numtostr(bidvol3,0),coloryellow);
108
109 drawtextex(1,1,x1,400,\'--------------------\',colorgreen);
110
111 drawtextex(1,1,x1,425,\'买四 \'+numtostr(bidprice4,n),colorwhite);
112 drawtextex(1,1,x2,425,numtostr(bidvol4,0),coloryellow);
113
114 drawtextex(1,1,x1,450,\'--------------------\',colorgreen);
115
116 drawtextex(1,1,x1,475,\'买五 \'+numtostr(bidprice5,n),colorwhite);
117 drawtextex(1,1,x2,475,numtostr(bidvol5,0),coloryellow);
118
119 drawtextex(1,1,x1,500,\'--------------------\',colorgreen);