- 精华
- 0
- 在线时间
- 148 小时
- UID
- 3803
- 积分
- 328
- 帖子
- 27
- 阅读权限
- 50
- 注册时间
- 2009-3-12
- 最后登录
- 2014-4-4
- 精华
- 0
- UID
- 3803
- 积分
- 328
- 帖子
- 27
- 主题
- 5
- 阅读权限
- 50
- 注册时间
- 2009-3-12
- 最后登录
- 2014-4-4
|
照葫芦画瓢写了一个60分钟调用10日线atr值,显示不对!
自己照葫芦画瓢写了一个60分钟调用10日线atr值。
//------------------------------------------------------------------------
// 简称: dayatr
// 名称: dayatr
// 类别: 用户函数
// 类型: 内建函数
// 输出: 数值型
//------------------------------------------------------------------------
Params
Numeric length(10);
Vars
Numeric atr;
string strkey;
string strValue;
Begin
atr= AverageFC(TrueRange,Length);;
strKey = DateToString(Date);
strValue = Text(atr);
SetTBProfileString("Dayatr",strKey,strValue);
Return atr;
End
//------------------------------------------------------------------------
// 简称: My60MinAtr
// 名称: 60分钟取日线ATR
// 类别: 技术指标
// 类型: 其它类
// 输出:
//------------------------------------------------------------------------
Params
NumericSeries Currentmaxdate(20090201);
Vars
NumericSeries dayatrValue;
StringSeries strKey;
string strValue;
Begin
If(Date!=Date[1] and date>Currentmaxdate)
{
strKey = DateToString(Date[1]);
}Else
{
strKey = strKey[1];
}
strValue = GetTBProfileString("Dayatr",strKey);
If(strValue != InvalidString)
{
dayatrValue = Value(strValue);
}Else
{
dayatrValue = dayatrValue[1];
}
PlotNumeric("Dayatr",DayMAValue);
End
1)输出不对,请老师看看那里有问题?谢谢
2)如果自动交易断线后,再连网,自动交易如果不用手工补有别的办法吗? |
|