关于模型转换 (文华财经WH8赢智V8.2)

投资者咨询:关于模型转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-8-1 7:05
 老师,麻烦将下面的MC模型转为文华,谢谢
Inputs:
 length(30),
 J(100),
 lots(1);
 
variables:
 mta(0),
 mtb(0),
 LRSlope(0),
 LRAngle(0),
 LRValue(0),
 LRIntercept(0),
 LRSlope1(0),
 LRAngle1(0),
 LRIntercept1(0),
 LRValue1(0),
 mt(0);
 
LinearReg(close,length,0,LRSlope, LRAngle, LRIntercept, LRValue);
mta=LRSlope;
LinearReg(mta*50,length,0,LRSlope1, LRAngle1, LRIntercept1, LRValue1);
mtb=LRSlope1;
mt=mta*mtb*50;
if(marketposition<>1 and mt>J and mta>0) then
 buy lots shares next bar at market;
 
if(marketposition<>-1 and mt>J and mta<0) then
 sellshort lots shares next bar at market;
技术人员回复
日期:2018-8-1 8:26
1楼模型语法结构和MQ宽语言的结构类似,其中LinearReg求线型回归的函数MQ软件也是提供的

所以1楼的模型可以在MQ软件中直接转换,改写参考如下


Params
Numeric length(30);
Numeric J(100);
Numeric lots(1);
 
vars
Numeric mta(0);
Numeric mtb(0);
Numeric LRSlope(0);
Numeric LRAngle(0);
Numeric LRValue(0);
Numeric LRIntercept(0);
Numeric LRSlope1(0);
Numeric LRAngle1(0);
Numeric LRIntercept1(0);
Numeric LRValue1(0);
Numeric mt(0);

Begin
LinearReg(close,length,0,LRSlope, LRAngle, LRIntercept, LRValue);
mta=LRSlope;
LinearReg(mta*50,length,0,LRSlope1, LRAngle1, LRIntercept1, LRValue1);
mtb=LRSlope1; 
mt=mta*mtb*50;
if(marketposition<>1 and mt>J and mta>0)
{
buy(lots,close);
 }
if(marketposition<>-1 and mt>J and mta<0) 
{
SellShort(lots,close);
 }
End
投资者咨询:关于模型转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-8-1 7:05
 无法转成WH8?
技术人员回复
日期:2018-8-1 10:05
wh8实现不了

1楼指标中MTA和MTB是求线性回归的斜率值,需要在MQ中使用LinearReg函数取

而wh8中FORCAST是取线性回归的预测值,取不到斜率的