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

投资者咨询:关于模型的转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-21 7:30

老师,麻烦将下述MC模型转成文华的,谢谢!

 

Inputs:

lots(1),K(3),ts(1.5),length(3),len1(25),len3(3),M(2.5),LENGTH1(12); 

variable:

llv(0),hhv(0),ma1(0),con1(False),con2(False),myprice(0),TRANGE(0),efficiency(False),max1(0),min1(0);

 

ma1=XAverage(l,length);

llv=lowest(c,len1);

hhv=highest(c,len1);

 

con1=l[1]>=hhv[len3] and h[1]>=ma1[len3] and h>=h[1];

con2=h[1]<=llv[len3] and l[1]<=ma1[len3] and l<=l[1];

 

TRange=AvgTrueRange(LENGTH1);

efficiency=absvalue(c-c[40])>=M*TRange;

 

max1=maxlist(open,h[1]);

min1=minlist(open,l[1]);

 

if (marketposition<>1 and con1 and efficiency[1]) then buy("Buy") lots share next bar at  max1 stop;

if (marketposition<>-1 and con2 and efficiency[1])then sellshort("SellShort") lots share next bar at min1 stop;


 

技术人员回复
日期:2018-5-21 8:28

1楼源码语法结构与MQ软件的宽语言类似,是可以通过MQ软件来实现

 

并且,MQ软件功能强大,基本可以兼容MC软件的源码的

您可以下载免费的MQ模拟试用版体验下:http://www.wenhua.com.cn/
 
修改参考:
 

Params
 Numeric lots(1);
 Numeric K(3);
 Numeric length(3);
 Numeric len1(25);
 Numeric  len3(3);
 Numeric  LENGTH1(12);
Vars
   NumericSeries ma1(0);
   NumericSeries llv1(0);
   NumericSeries hhv1(0);
   NumericSeries ts(0);
   NumericSeries M(0);
   NumericSeries TRange(0);
   NumericSeries efficiency(0);
   NumericSeries max11(0);
   NumericSeries min11(0);
   NumericSeries con1(0);
   NumericSeries con2(0);
Begin
ts=1.5;
M=2.5;
ma1=XAverage(low,length);
llv1=lowest(Close,len1);
hhv1=highest(Close,len1);
con1=low[1]>=hhv1[len3] and high[1]>=ma1[len3] and high>=high[1];
con2=High[1]<=llv1[len3] and low[1]<=ma1[len3] and low<=low[1];
TRange=AvgTrueRange(LENGTH1);
efficiency=abs(Close-close[40])>=M*TRange;
max11=max(open,High[1]);
min11=min(open,Low[1]);

 

if (marketposition<>1 and con1 and efficiency[1] )
{
Buy;
}
IF(marketposition==1  && Close>max11 )
{
Sell;
}

if (marketposition<>-1 and con2 and efficiency[1])
{
SellShort;
}
IF(marketposition==-1  && Close>min11 )
{
BuyToCover;
}
End

 
 
投资者咨询:关于模型的转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-21 7:30
 没法改为WH8平台使用吗?
技术人员回复
日期:2018-5-21 18:39
分析您的历史发帖,因为MC软件的语言与MQ软件宽语言更接近

所以建议您通过MQ软件来实现,您后续的学习和编写也更加熟悉顺手,您考虑一下
投资者咨询:关于模型的转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-21 7:30
 但是MQ包年要3万,好贵呀!WH8简洁明了,价格适中。比较适合我
技术人员回复
日期:2018-5-21 19:12
参考:


K:=3;
LENGTH:=3;
LEN1:=25;
LEN3:=3;
TS:=1.5;
M:=2.5;
LENGTH1:=12;
MA1:=MA(LOW,LENGTH);
LLV1:=LLV(CLOSE,LEN1);
HHV1:=HHV(CLOSE,LEN1);
CON1:=REF(L,1)>=REF(HHV1,LEN3) AND REF(H,1)>=REF(MA1,LEN3) AND HIGH>=REF(H,1);
CON2:=REF(H,1)<=REF(LLV1,LEN3) AND REF(L,1)<=REF(MA1,LEN3) AND LOW<=REF(L,1);
TR :=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
TRANGE:=MA(TR,LENGTH1);
EFFICIENCY:=ABS(CLOSE-REF(C,40))>=M*TRANGE;
MAX11:=MAX(OPEN,REF(H,1));
MIN11:=MIN(OPEN,REF(L,1));
 
BKVOL=0 AND CON1 AND REF(EFFICIENCY,1),BK;
BKVOL>0   && CLOSE>MAX11,SP;
SKVOL=0  AND CON2 AND REF(EFFICIENCY,1),SK;
SKVOL>0 && CLOSE>MIN11,BP;
AUTOFILTER;