开拓者期货期权程序化系统交易论坛
标题:
如何用SetTBProfileString在5分线调用30分线的数据?
[打印本页]
作者:
wsjtry
时间:
2019-1-3 14:49:45
标题:
如何用SetTBProfileString在5分线调用30分线的数据?
请假,如何用SetTBProfileString在5分线跨周期调用30分线、60分的数据?该怎么写呢?或者参考什么贴?谢谢,非常感谢。
作者:
小米
时间:
2019-1-3 15:33:19
http://bbs.tb18.net/thread-4469-1-1.html
作者:
wsjtry
时间:
2019-1-3 17:19:58
本帖最后由 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分,
请教,怎么办呢?谢谢
作者:
wsjtry
时间:
2019-1-3 17:32:27
小米 发表于 2019-1-3 15:33
http://bbs.tb18.net/thread-4469-1-1.html
我参照网址的修改了,
目前同周期30分调用30分周期的数据正常,
但是小周期调用大周期就不正常,如5分调用30分,
请教,怎么办呢?
谢谢,非常感谢。
欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/)
Powered by Discuz! X2