- 精华
- 0
- 在线时间
- 137 小时
- UID
- 265766
- 积分
- 266
- 帖子
- 125
- 阅读权限
- 50
- 注册时间
- 2018-5-22
- 最后登录
- 2022-8-21
- 精华
- 0
- UID
- 265766
- 积分
- 266
- 帖子
- 125
- 主题
- 67
- 阅读权限
- 50
- 注册时间
- 2018-5-22
- 最后登录
- 2022-8-21
|
本帖最后由 wsjtry 于 2019-1-3 17:31 编辑
新建窗口,这个指标放入大周期30分,60分等,把MA值写数据库供小周期调用- Vars
- Numeric length(15);
- NumericSeries MA;
- string strkey;//设置键名
- string strValue;//设置键值
- Numeric RQSJ;//日期时间
- Begin
- MA = XAverage(Close,length);
- RQSJ=Date*10000+Hour*100+Minute;//日期时间,作为键名
- strKey = Text(RQSJ);//设置键名,以日期小时分钟为键名
- strValue = Text(MA);//设置键值
- WData=SetTBProfileString("KtMA60",strKey,strValue);//数据块名,键名,键值
- PlotNumeric("MA",MA);
- Commentary("写键名="+Text(RQSJ));
- End
复制代码 //新建窗口,这个指标放入小周期并且小于被调用周期,如5分,10分,15分周期。- Vars
- NumericSeries KtValue;//读出的数据
- NumericSeries RQSJ;//日期时间
- StringSeries strKey;//读取键名
- StringSeries strValue;//读取键值
- Begin
- RQSJ=Date*10000+Hour*100+Minute;//日期时间,作为键名
- If(RQSJ!=RQSJ[1]){strKey = Text(RQSJ[1]);}//不同时间K线,取上个时间为键名
- Else{strKey = strKey[1];}//取上个时间为键名
- strValue = GetTBProfileString("KtMA60",strKey);//根据数据库、键名去读取键值
- If(strValue != InvalidString){KtValue = Value(strValue);}//读数据有效
- Else{KtValue = KtValue[1];}//读数据无效
- PlotNumeric("键值",KtValue);
- Commentary("读键名="+Text(RQSJ));
- Commentary("读键值="+Text(KtValue));
- End
复制代码 目前同周期30分调用30分周期的数据正常,
但是小周期调用大周期就不正常,如5分调用30分,
请教,怎么办呢?谢谢
|
|