版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、TB跨周期、跨品种调用数据的实现方法 编辑课件关于跨周期使用算法整合当前周期上的bar数据,取得相应周期的bar数据。(难)学习请点击我使用函数DataConvert。使用数据库SetTBProfileString、GetTBProfileString.编辑课件写公式信息文件SetTBProfileString写入Bool SetTBProfileString(String strSection,String strKey,String strValue)GetTBProfileString读取String GetTBProfileString(String strSection,String
2、 strKey)strSection:块名strKey:键名strValue:存储值编辑课件图表1图表2图表3编辑课件跨周期举例(一)以5分钟周期调用日线指标数据举例讲解具体应用。编辑课件操作步骤一1、新建一个工作区,包含上下两个图表窗体,上面选择日线周期,下面选择5分钟周期。编辑课件操作步骤二2、新建一个技术指标,命名为MyDayMA。编译成功后插入日线图表中。详细代码ParamsNumeric length(10);VarsNumeric MA;string strkey;string strValue;BeginMA = AverageFC(Close,length);strKey =
3、DateToString(Date);strValue = Text(MA); SetTBProfileString(DayMA,strKey,strValue);PlotNumeric(MA,MA);End编辑课件操作步骤三3、新建一个技术指标,My5MinMA。编译成功后插入5分钟图表中。编辑课件VarsNumericSeries DayMAValue;StringSeries strKey;string strValue;BeginIf(Date!=Date1)strKey = DateToString(Date1);ElsestrKey = strKey1;strValue = Get
4、TBProfileString(DayMA,strKey);If(strValue != InvalidString)DayMAValue = Value(strValue);ElseDayMAValue = DayMAValue1;PlotNumeric(DayMA,DayMAValue);End步骤三 详细代码编辑课件跨周期例子(一)上图为日线图下图为5分钟图从五分钟上读取日线图上的MA数据编辑课件跨品种、跨周期例子(二)在1分钟线上取得1小时和日线周期举例讲解具体应用。编辑课件操作步骤一1、新建一个工作区,包含上下三个图表窗体,上面左边选择股指指数日线,上面右边选择股指指数小时线,下面选
5、择1分钟股指IF1101周期。编辑课件操作步骤二2、新建一个技术指标,命名为DayLine。编译成功后插入日线图表中。Params Numeric length(10); Numeric length1(10); Numeric length2(20);Vars Numeric MA1; Numeric MA2; string strkeyDate;Begin MA1 = AverageFC(Close,length1); MA2 = AverageFC(Close,length2); strKeyDate = DateToString(Date);SetTBProfileString(Sym
6、bol,DayMA1:+strKeyDate,Text(MA1);SetTBProfileString(Symbol,DayMA2:+strKeyDate,Text(MA2); PlotNumeric(DayMA1,MA1); PlotNumeric(DayMA2,MA2);End编辑课件操作步骤三3、新建一个技术指标,HourLine。编译成功后插入小时线图表中。编辑课件Params Numeric length(10); Numeric length1(10); Numeric length2(20);Vars Numeric MA1; Numeric MA2; string strkey
7、Date;Begin MA1 = AverageFC(Close,length1); MA2 = AverageFC(Close,length2); strKeyDate = DateToString(Date)+:+Text(Hour); SetTBProfileString(Symbol,HourMA1:+strKeyDate,Text(MA1); SetTBProfileString(Symbol,HourMA2:+strKeyDate,Text(MA2); PlotNumeric(HourMA1,MA1); PlotNumeric(HourMA2,MA2);End编辑课件操作步骤四4、
8、新建一个技术指标,MinLine。编译成功后插入1分钟图表中。编辑课件Vars NumericSeries DayMA1; NumericSeries DayMA2; NumericSeries HourMA1; NumericSeries HourMA2; StringSeries strKeyDate; StringSeries strKeyHour; string DayValue1; string DayValue2; string HourValue1; string HourValue2;Begin If(Date!=Date1) strKeyDate = DateToString
9、(Date); Else strKeyDate = strKeyDate1; If(Hour!=Hour1) strKeyHour = DateToString(Date)+:+Text(Hour); Else strKeyHour = strKeyHour1;编辑课件/读取日线 DayValue1 = GetTBProfileString(“If000,DayMA1:+strKeyDate); DayValue2 = GetTBProfileString(“If000,DayMA2:+strKeyDate);/读取小时线 HourValue1 = GetTBProfileString(“If
10、000,HourMA1:+strKeyHour); HourValue2 = GetTBProfileString(“If000,HourMA2:+strKeyHour);DayMA1 = Value(DayValue1);DayMA2 = Value(DayValue2);HourMA1 = Value(HourValue1);HourMA2 = Value(HourValue2);/输出PlotNumeric(DayMA1,DayMA1);PlotNumeric(DayMA2,DayMA2);PlotNumeric(HourMA1,HourMA1);PlotNumeric(HourMA2,
11、HourMA2);End编辑课件编辑课件跨周期实现从1分钟周期上取得日线上的KDJ信息用到的函数有SetTBProfileString、GetTBProfileString、熟悉与掌握 (练习一)编辑课件跨周期例子三编辑课件在日线图上保存每日的KDJ数据ParamsNumeric Length(14);Numeric SlowLength(3);Numeric SmoothLength(3);VarsNumericSeries HighestValue;NumericSeries LowestValue;NumericSeries KValue;Numeric DValue;StringSer
12、ies strKeyDate;/日期变量,使用序列字符串新建技术指标公式,命名为DayAvgLine,公式内容如下:编辑课件Begin/获得日期If(Date!=Date1) strKeyDate = DateToString(Date);Else strKeyDate = strKeyDate1;/计算KDJ值HighestValue = HighestFC(High, Length);LowestValue = LowestFC(Low, Length); KValue = SummationFC(Close - LowestValue,SlowLength)/SummationFC(Hi
13、ghestValue-LowestValue,SlowLength)*100;DValue = AverageFC(KValue,SmoothLength);编辑课件/将KDJ信息保存在数据库中SetTBProfileString(Symbol,KValue_+strKeyDate,Text(KValue);SetTBProfileString(Symbol,DValue_+strKeyDate,Text(DValue);SetTBProfileString(Symbol,JValue_+strKeyDate,Text(3*KValue - 2*DValue);/在日线图上输出KDJ值Plot
14、Numeric(KValue,KValue);PlotNumeric(DValue,DValue);PlotNumeric(JValue,3*KValue - 2*DValue);End编辑课件在分钟线上取得相应日期的KDJ值新建技术指标公式,命名为GetDayAvgLine,公式内容如下:VarsNumericSeries KValue;NumericSeries DValue;NumericSeries JValue;StringSeries strKeyDate;编辑课件BeginIf(Date!=Date1) strKeyDate = DateToString(Date);Else strKeyDate = strKeyDate1;KValue=Value(GetTBProfileString(Symbol,KValue_+strKeyDate);DValue=Value(GetTBProfileString(Symbol,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 土工膜软式透水管防渗土工膜项目节能评估报告模板
- 幼儿园后勤培训会议记录
- 中医护理学 课件 模块四 疾病病因与护理评估
- 2024三季度非银行业核心观点汇报:资本市场改革深化关注“真价值”与“真成长”
- 细胞通过分裂产生新细胞 提升练习-2024-2025学年人教版生物七年级上册
- 观察周边环境中的生物 课件+2024-2025学年人教版七年级生物上册
- 2021年山西省小学教师资格证《小学综合素质》科目真题冲刺卷
- 元宵节幼儿奖状模板
- 《2024年 材料基因工程数据生态系统》范文
- 2023年4月自考03297企业文化试题及答案含解析
- 人教版八年级数学上册11.2与三角形有关的角 同步分层训练(基础卷)(附解析答案)
- 肥胖患者的长期体重管理及药物临床应用指南(2024版)解读
- 部编版二年级上册《道德与法治》教学计划 (二)
- SMP-10-004-00 药品上市后安全性研究管理规程
- Unit 4 练习题人教版2024七年级英语上册
- 2024离婚协议书公证范本
- 贵州闪婚合同
- 2024山东德州市宁津县市场监督管理局招聘(第二批)【重点基础提升】模拟试题(共500题)附带答案详解
- 2023版29490-2023企业知识产权合规管理体系管理手册
- 新版北师大数学八年级上册第二章《实数》复习课学案
- 国家开放大学《理工英语3》章节测试参考答案
评论
0/150
提交评论