老师,麻烦将下述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;
1楼源码语法结构与MQ软件的宽语言类似,是可以通过MQ软件来实现
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