- UID
- 2
- 积分
- 2869668
- 威望
- 1384862 布
- 龙e币
- 1484806 刀
- 在线时间
- 13082 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-15
|
版本二:第二种版源码:
适合日线以下 任何周期 中间直接调用 日线数据 不过每天要把画面切换到 日线周期 刷新一个昨日的日线数据
还有注意费率设置 要改成期货 15% 合约单位 按该品种自己调整 手续费自己调整
- input:k(0.7,0.1,1,0.1);
- predayhigh:=callstock(stklabel,vthigh,6,-1);//昨日最高价
- predaylow:=callstock(stklabel,vtlow,6,-1);//昨日最低价
- predayclose:=callstock(stklabel,vtclose,6,-1);//昨日收盘价
- predayrange:=max(predayhigh-predayclose,predayclose-predaylow);//取大波动值
- dayopen:=callstock(stklabel,vtopen,6,0);//今天开盘价
- upperband:intpart(dayopen+k*predayrange),colorred;//区间上沿
- lowerband:intpart(dayopen-k*predayrange),colorgreen;//区间下沿
- 下日波动:max(callstock(stklabel,vthigh,6,0)-callstock(stklabel,vtclose,6,0),callstock(stklabel,vtclose,6,0)-callstock(stklabel,vtlow,6,0))*0.7;
- if holding=0 then begin
- if high>=upperband then
- buy(1,volunit,limitr,max(open,upperband));
- end
- if holding=0 then begin
- if low<=lowerband then
- buyshort(1,volunit,limitr,min(open,lowerband));
- end
- if holding>0 then begin
- if low<=lowerband then begin
- sell(1,holding,limitr,min(open,lowerband));
- buyshort(1,volunit,limitr,min(open,lowerband));
- end
-
- if time>=closetime(0) then
- sell(1,holding,limitr,close);
- end
- if holding<0 then begin
- if high>=upperband then begin
- sellshort(1,holding,limitr,max(open,upperband));
- buy(1,volunit,limitr,max(open,upperband));
- end
- //www.cxh99.com
- if time>=closetime(0) then
- sellshort(1,holding,limitr,close);
- end
- 资产:ASSET,PRECISION0,NOAXIS,COLORFF00FF;
- goodin:=(1-(asset/hhv(asset,5520)))*100;
- 资产回撤百分比:goodin;
- 资产实际亏损:hhv(asset,5520)-asset,COLORgreen;
复制代码 |
|