//------------------------------------------------------------------------
// 简称: xx
// 名称:
// 类别: 公式应用
// 类型: 用户应用
// 输出: Void
//------------------------------------------------------------------------
Params
Numeric Price(1); //数值型序列值
Numeric Length(10); //周期数
Numeric TgtBar(0); //Bar偏移
Vars
Numeric LRSlope;
Numeric LRAngle;
Numeric LRIntercept;
Numeric LRValue;
Begin
LinearReg(Price, Length, TgtBar, LRSlope, LRAngle, LRIntercept, LRValue);
Return LRValue;
Events
OnBar(ArrayRef<Integer> indexs)
{
Range[0:DataCount - 1]
{
if(CurrentBar <= 10)
{
//求线性回归的角度
Numeric value = LinearRegValue(High, 5);
Print("Symbol:" + Symbol + ",LinearRegValue:" + Text(value));
}
}
}
//------------------------------------------------------------------------
// 编译版本 2023/01/01 112027
// 版权所有 yxx32518
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------
这公式错误怎么改?
我是想要在图表上划出线性回归值,该怎么改呢,老师修改后还是不能划出这条线。
如果不管您的意图,只是让这个公式通过编译的话,可以这么改:
Params
Numeric Price(1); //数值型序列值
Numeric Length(10); //周期数
Numeric TgtBar(0); //Bar偏移
Vars
Numeric LRSlope;
Numeric LRAngle;
Numeric LRIntercept;
Numeric LRValue;
Events
OnBar(ArrayRef<Integer> indexs)
{
Range[0:DataCount - 1]
{
if(CurrentBar <= 10)
{
//求线性回归的角度
Numeric value = LinearRegValue(High, 5);
Print("Symbol:" + Symbol + ",LinearRegValue:" + Text(value));
}
}
}