- 精华
- 0
- 在线时间
- 153 小时
- UID
- 109920
- 积分
- 166
- 帖子
- 135
- 阅读权限
- 40
- 注册时间
- 2012-4-10
- 最后登录
- 2013-5-14
- 精华
- 0
- UID
- 109920
- 积分
- 166
- 帖子
- 135
- 主题
- 1
- 阅读权限
- 40
- 注册时间
- 2012-4-10
- 最后登录
- 2013-5-14
|
一下为代码
高手在看看代码有没问题
//------------------------------------------------------------------------
// 简称: abc
// 名称: abc
// 类别: 公式应用
// 类型: 用户应用
// 输出:
//------------------------------------------------------------------------
Params
Numeric maLen1(10);
Numeric maLen2(50);
Numeric lots(1);
Numeric offset(0);
Vars
Numeric MyEntryPrice;
NumericSeries firstPrice;
NumericSeries LastPrice;
NumericSeries firstPrice2;
NumericSeries LastPrice2;
Numeric AddSet(0.01);
Numeric SubSet(-0.01);
Numeric ma1;
Numeric ma2;
Numeric i_offset;
Begin
ma1 = Average(Open,maLen1);
ma2 = Average(Open,maLen2);
PlotNumeric("ma1",ma1);
PlotNumeric("ma2",ma2);
i_offset = offset*MinMove*PriceScale;
If(CurrentBar > maLen2)
{
If(MarketPosition == 0)
{
If(Open>ma1 and ma1>ma2)
{
firstprice=open+i_offset;
lastprice=firstprice;
Buy(7,firstprice);
Return;
}
If(Open < ma1 and ma1<ma2)
{
firstPrice2 = Open-i_offset;
LastPrice2 = firstPrice2;
SellShort(7,firstPrice2);
Return;
}
}
}
else If(MarketPosition == 1)
{
While(CurrentEntries < 2&& High >= LastPrice + AddSet*firstprice)
{LastPrice=LastPrice + AddSet*firstprice;
If(o>=LastPrice + AddSet*firstprice)
{LastPrice = o;
}
Buy(3,LastPrice);
}
While(CurrentEntries < 3&& High >= LastPrice + AddSet*firstprice)
{LastPrice=LastPrice + AddSet*firstprice;
If(o>=LastPrice + AddSet*firstprice)
{LastPrice = o;
}
Buy(1,LastPrice);
}
}
else if (MarketPosition == -1)
{
While(CurrentEntries < 2&& Low <= LastPrice2 + subSet*firstprice2)
{LastPrice2=LastPrice2+ subSet*firstprice2;
If(o<=LastPrice2 + subSet*firstprice2)
{LastPrice2=o;
}
SellShort(3,LastPrice2);
}
While(CurrentEntries < 3&& Low <= LastPrice2 + subSet*firstprice2)
{LastPrice2=LastPrice2+ subSet*firstprice2;
If(o<=LastPrice2 + subSet*firstprice2)
{LastPrice2=o;
}
SellShort(1,LastPrice2);
}
}
If(MarketPosition == 1)
{
If(Open < ma1)
{
Sell(0,Open-i_offset);
Return;
}
Else If(l/AvgEntryPrice<0.98)
{Sell(0,MyEntryPrice*0.98-i_offset);
}
Else If(o/AvgEntryPrice<0.98)
{Sell(0,o-i_offset);}
}
If(MarketPosition == -1)
{
If(Open > ma1)
{
BuyToCover(0,Open+i_offset);
Return;
}
Else If(h/AvgEntryPrice>1.02 )
{
BuyToCover(0,AvgEntryPrice*1.02+i_offset);
}
Else if(o/AvgEntryPrice>1.02)
{BuyToCover(0,o+i_offset);}
}
End
//------------------------------------------------------------------------
// 编译版本 GS2010.12.08
// 用户版本 2012/09/09 10:50
// 版权所有 zhuanqian
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------ |
|