请高手帮我改成成金魔方语言
Params//--是否显示指标线--------------------------------------------------------------------- Numeric Lots(1);//交易手数 Numeric Length1(3);//5日均线 Numeric Length2(36);//55日均线 Vars NumericSeries MA1; NumericSeries MA2;//--------------------------------------------- NumericSeries BKPrice; NumericSeries SKPrice; NumericSeries BKBar; NumericSeries SKBar; NumericSeries BPPrice; NumericSeries SPPrice; NumericSeries BKFuying; NumericSeries BKFuyingBar; NumericSeries SKFuying; NumericSeries SKFuyingBar; NumericSeries BKhold; NumericSeries SKhold; NumericSeries BPhold; NumericSeries SPhold;//------------------------------------------------- NumericSeries MAxiachuan; NumericSeries MAxiachuanBar; NumericSeries MAshangchuan; NumericSeries MAshangchuanBar; Begin MA1=AverageFC(CLOSE,Length1); MA2=AverageFC(CLOSE,Length2);//----------------------------------------------------------- PlotNumeric("MA1",MA1,0,red); PlotNumeric("MA2",MA2,0,Blue); //多单开仓平仓// If(MA1>MA2 && MA1>MA2 && MA1<MA2 && Open>MA2 && MarketPosition<1) If(MA1>MA2 && MA1>MA2 && Open>MA2 && MarketPosition<1 && SPhold<1 && Open-MA2<0.05*open) { Buy(Lots,OPEN); BKhold=1; SPhold=0; BPhold=0; BKPrice=OPEN; BKBar=CurrentBar; Commentary("多单开仓1"); }// If(MA1<MA2 && MA1<MA2 && MA1>MA2 && MarketPosition==1) If(MA1<MA2 && MA1<MA2 && MarketPosition==1 && Open<MA2) { Sell(Lots,OPEN); SPPrice=OPEN; BKhold=0; SPhold=0; Commentary("多单平仓A"); } If(High/MA2>1.15 && MarketPosition==1) { Sell(Lots,MA2*1.15); SPPrice=OPEN; BKhold=0; SPhold=1; Commentary("多单平仓B"); }//顺势开仓条件 If(BKhold==1 && SPPrice-Low>0.04*SPPrice && MarketPosition<1 && SPPrice*0.96>MA2) { Buy(Lots,SPPrice*0.96); BKhold=1; SPhold=0;. BKPrice=OPEN; BKBar=CurrentBar; Commentary("多单开仓2"); }//空单开仓平仓// If(MA1<MA2 && MA1<MA2 && MA1>MA2 && Open<MA2 && MarketPosition>-1) If(MA1<MA2 && MA1<MA2 && Open<MA2 && MarketPosition>-1 && BPhold<1 && MA2-Open<0.05*Open) { SellShort(Lots,OPEN); SKhold=1; BPhold=0; SPhold=0; SKPrice=OPEN; SKBar=CurrentBar; Commentary("空单开仓1"); }// If(MA1>MA2 && MA1>MA2 && MA1<MA2 && MarketPosition==-1) If(MA1>MA2 && MA1>MA2 && MarketPosition==-1 && Open>MA2) { BuyToCover(Lots,OPEN); BPPrice=OPEN; SKhold=0; BPhold=0; Commentary("空单平仓A"); } If(Low/MA2<0.85 && MarketPosition==-1) { BuyToCover(Lots,MA2*0.85); BPPrice=MA2*0.85; SKhold=0; BPhold=1; Commentary("空单平仓B"); }//顺势开仓条件 If(BPhold==1 && High-BPPrice>0.04*BPPrice && MarketPosition>-1 && BPPrice*1.04<MA2) { SellShort(Lots,BPPrice*1.04); SKhold=1; BPhold=0; SKPrice=OPEN; SKBar=CurrentBar; Commentary("空单开仓2"); }//--多单持仓,价位上涨跟踪 IF(BKhold==0) { BKFuying=0; BKFuyingBar=CurrentBar; } IF(BKhold>0 && CurrentBar-BKBar==0) { BKFuying=BKPrice; BKFuyingBar=CurrentBar; } IF(BKhold>0 && High>BKFuying) { BKFuying=High; BKFuyingBar=CurrentBar; }//--空单持仓,价位下跌跟踪 IF(SKhold==0) { SKFuying=100000; SKFuyingBar=CurrentBar; } IF(SKhold>0 && CurrentBar-SKBar==0) { SKFuying=100000; SKFuyingBar=CurrentBar; } IF(SKhold>0 && Low<SKFuying) { SKFuying=Low; SKFuyingBar=CurrentBar; }//多单止盈平仓 && close<open IF(BKFuying-BKPrice>=0.25*BKPrice && BKhold>0 && CurrentBar-BKFuyingBar>1) { Sell(Lots,BKPrice*1.25); BKhold=0; SPhold=1; Commentary("多单平仓C"); }//空单止盈平仓 IF(SKPrice-SKFuying>=0.25*SKPrice && SKhold>0 && CurrentBar-SKFuyingBar>1) { BuyToCover(Lots,SKPrice*0.75); SKhold=0; BPhold=1; Commentary("空单平仓C"); }//---------------------------------------------------------------------------------- //多单止损平仓 IF(BKPrice-Low>=0.04*BKPrice && BKhold>0) { Sell(Lots,BKPrice*0.96); BKhold=0; SPhold=0; Commentary("多单平仓D"); }//空单止损平仓 IF(High-SKPrice>=0.04*SKPrice && SKhold>0) { BuyToCover(Lots,SKPrice*1.04); SKhold=0; BPhold=0; Commentary("空单平仓D"); } End是个隔夜系统,不知道是操作啥品种,啥周期
页:
[1]