- 精华
- 0
- 在线时间
- 23 小时
- UID
- 219202
- 积分
- 29
- 帖子
- 20
- 阅读权限
- 10
- 注册时间
- 2015-9-9
- 最后登录
- 2016-1-4
- 精华
- 0
- UID
- 219202
- 积分
- 29
- 帖子
- 20
- 主题
- 4
- 阅读权限
- 10
- 注册时间
- 2015-9-9
- 最后登录
- 2016-1-4
|
本帖最后由 niejianyong 于 2015-9-15 00:27 编辑
功能:早盘1min、3min、5min k线上标注时间和开盘信息
问题:1.麻烦看看代码编写是否有问题,哪里可以优化,谢谢
2.在顶部显示的字符串能否换行
代码如下:- //------------------------------------------------------------------------
- // 简称: LAB_K
- // 名称: k线标注
- // 类别: 公式应用
- // 类型: 用户应用
- // 详细: 在早盘K线上标注时间
- //------------------------------------------------------------------------
- Params
- // Numeric N(10);
- // Numeric M(5);
- Vars
- String Title_str(""); //记录k线上标注的字符串
- Begin
- //在1min、3min、5min K线上标注
- if (BarType<>1) //不是分钟线就不标注
- Return;
- else if (BarInterval<>1 and BarInterval<>3 and BarInterval<>5) //不是1分钟、3分钟、5分钟不标注
- Return;
- Else if (BarInterval==1) //1min 标注方法
- {
- if (time>=0.0915 and time<=0.1030) //时间介于9:15-10:30之间的标注
- {
- if (time*10000/5==Round(time*10000/5,0)) //10:30分前每5min标注一个
- {
- PlotString ("lab_1min2","*",high+7,blue); //在整5min k线上标注“*”
- }
- }
- if (time==0.1430) //时间=14:30标注
- PlotString ("lab_1min2","*",high+7,blue);
- if (time==0.1500) //时间=15:00标注
- PlotString ("lab_1min2","*",high+7,blue);
- }
- Else if (BarInterval==3) //3min 标注方法
- {
- //空缺
- }
- Else if (BarInterval==5) //5min 标注方法
- {
- //空缺
- }
-
- //标注开盘、最高等
- if (BarType<>1) //不是分钟线就不标注
- {
- //空缺
- }
- else if (BarInterval<>1 and BarInterval<>3 and BarInterval<>5) //不是1分钟、3分钟、5分钟不标注
- {
- //空缺
- }
- else if (time==0.0915)
- {
- Title_str = " "+RelativeSymbol + "_" + Text(date) + " " + " 开盘:"+Text(open) + " 收盘:"+Text(Close) + " 最高:"+Text(High) + " 最低:"+Text(Low) + " 上影:"+Text(High-max(open,close)) + " 下影:"+Text(min(open,close)-low);
- }
- PlotString("lab_title",Title_str);
-
- End
- //------------------------------------------------------------------------
- // 编译版本 GS2010.12.08
- // 用户版本 2015-09-13 20:30:19
- // 版权所有 niejianyong
- // 更改声明 TradeBlazer Software保留对TradeBlazer平台
- // 每一版本的TrabeBlazer公式修改和重写的权利
- //------------------------------------------------------------------------
复制代码 |
|