|
本帖最后由 yyy999 于 2013-11-1 20:53 编辑
Params
Numeric FastLength(6); //短周期
Numeric SlowLength(24); //长周期
Numeric fVol(1); //下单手数
Vars
NumericSeries AvgValue1;
NumericSeries AvgValue2;
Begin
AvgValue1 = EMA(CLOSE,FastLength);
AvgValue2 = EMA(CLOSE,SlowLength);
PlotNumeric("MA1",AvgValue1);
PlotNumeric("MA2",AvgValue2);
//均线交叉时开仓
if(AvgValue1 > AvgValue2 )
if(AvgValue1[1] < AvgValue2[1] )
{
If(A_SellPosition > 0){
BuyToCover(0,0);
}
if(A_BuyPosition == 0)
{
Buy(fVol,0);
PlotText(Q_AskPrice+MinMove* PriceScale,"上穿");
}
}
if(AvgValue1[1] > AvgValue2[1] )
if(AvgValue1 < AvgValue2)
{
If(A_BuyPosition > 0){
Sell(0,0);
}
if(A_SellPosition == 0 )
{
SellShort(fVol,0);
PlotText(Q_BidPrice-MinMove* PriceScale,"下穿");
}
}
End
|
|