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

投资者咨询:关于模型转换 (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-6-6 7:12
 老师,麻烦请将下面的MC模型转为WH8,谢谢
Params

Numeric Qty(1);
Numeric Length(18);
Numeric RangeLimit(3.37);
Numeric TrailingStart1(110);
Numeric TrailingStart2(250);
Numeric TrailingStop1(135);
Numeric TrailingStop2(120);
Numeric StopLossSet(185);
Numeric StopLimit(10);
Numeric StopStartBar(48);
Numeric Sslippage(0);

Vars

Numeric MinPoint(0);
NumericSeries AAPV(0);
NumericSeries AAPVMA(0);
BoolSeries BuyCon(False);
BoolSeries SellCon(False);
BoolSeries SellShortCon(False);
BoolSeries BuyToCoverCon(False);
BoolSeries UpCon(False);
NumericSeries MyEntryPrice(0);
NumericSeries MyExitPrice(0);
NumericSeries HighestAfterEntry(0);      
NumericSeries LowestAfterEntry(0);
NumericSeries HL(0);
NumericSeries VolMA(0);
NumericSeries VolMA2(0);
NumericSeries LongStop(0);
NumericSeries ShortStop(0);
NumericSeries HighestBarNo(0);
NumericSeries LowestBarNo(0);
NumericSeries HighestCloseAfterEntry(0);     
NumericSeries LowestCloseAfterEntry(0);
   
Begin
   
MinPoint=MinMove*PriceScale;//一跳
MyEntryPrice=avgentryprice; //均价
VolMA=AdaptiveMovAvg(V[1],Length,2,30);//Length均量
VolMA2=AdaptiveMovAvg(VolMA,RoundUp(Length/2,0),2,30);//再次均量平滑
UpCon=VolMA[1]>VolMA2[1] && VolMA>VolMA2;//增量上升
HL=AverageFC((High - Low),Length);//高低价Length平均波幅
AAPV =open[1]*0.1375+open*0.1375+close[1]*0.1125+close*0.1125+high[1]*0.125+high*0.125+low[1]*0.125+low*0.125;//中值线



AAPVMA=AdaptiveMovAvg(AAPV,Length,2,30);

BuyCon =  ( Close[4]>=AAPV[4] and Close[3]>=AAPV[3] and Close[2]>=AAPV[2] and Close[1]>=AAPV[1])   and UpCon;

SellShortCon =  (Close[1]<=AAPV[1] and Close[4]<=AAPV[4] and Close[3]<=AAPV[3] and Close[2]<=AAPV[2]) and UpCon;

if(BuyCon And Close[1] > Open[1] And Close[2] > Open[2] and marketposition<=0) Buy(0,Open);
          
if(SellShortCon And Close[1] < Open[1] And Close[2] < Open[2] and marketposition>=0) SellShort(0,Open);

PlotNumeric("均线",AAPV,0,Rgb(199,199,199));
PlotNumeric("均线2",iAAPV,0,Rgb(199,0,199));

End

技术人员回复
日期:2018-6-6 8:37
 不同软件函数机制不同,改写后会有一定的差异

请参考:

QTY:=1;
LENGTH:=18;
RANGELIMIT:=3.37;
TRAILINGSTART1:=110;
TRAILINGSTART2:=250;
TRAILINGSTOP1:=135;
TRAILINGSTOP2:=120;
STOPLOSSSET:=185;
STOPLIMIT:=10;
STOPSTARTBAR:=48;
MINPOINT:=MINPRICE;//一跳
MYENTRYPRICE:=BKPRICE/ SKPRICE; //均价
VOLMA:=SMA(V,LENGTH,30);//LENGTH均量
VOLMA2:=SMA(VOLMA,ROUND(LENGTH/2,0),30);//再次均量平滑
UPCON:=VOLMA>VOLMA2 && VOLMA>VOLMA2;//增量上升
HL:=MA((HIGH - LOW),LENGTH);//高低价LENGTH平均波幅
AAPV :OPEN*0.1375+OPEN*0.1375+CLOSE*0.1125+CLOSE*0.1125+HIGH*0.125+HIGH*0.125+LOW*0.125+LOW*0.125;//中值线
AAPVMA:=SMA(AAPV,LENGTH,30);
BUYCON :=  ( REF(CLOSE>=AAPV,3) AND REF(CLOSE>=AAPV,2) AND REF(CLOSE>=AAPV,1) AND CLOSE>=AAPV )   AND UPCON;
SELLSHORTCON :=  (CLOSE<=AAPV AND REF(CLOSE<=AAPV,3) AND REF(CLOSE<=AAPV,2) AND REF(CLOSE<=AAPV,1)) AND UPCON;
BUYCON AND CLOSE > OPEN AND REF(CLOSE> OPEN,1) ,BPK;        
SELLSHORTCON AND CLOSE < OPEN AND REF(CLOSE< OPEN,1) ,SPK;
AUTOFILTER;