- 精华
- 0
- 在线时间
- 34 小时
- UID
- 4125
- 积分
- 99
- 帖子
- 20
- 阅读权限
- 30
- 注册时间
- 2009-4-14
- 最后登录
- 2020-1-20
- 精华
- 0
- UID
- 4125
- 积分
- 99
- 帖子
- 20
- 主题
- 7
- 阅读权限
- 30
- 注册时间
- 2009-4-14
- 最后登录
- 2020-1-20
|
本帖最后由 yxq01234 于 2014-10-24 21:36 编辑
根据海龟修改的简单均线系统,请大家帮忙给看看,信号不对:大于18日均线+ATR开仓,收盘价再大于上次开仓价+ATR加仓,最多加3次仓。
Params
Numeric Length(14) ;
Numeric Length2(20);
Vars
NumericSeries TurtleUnits; // 交易单位
Numeric A;
NumericSeries AvgValue1;
Numeric myEntryPrice;
Numeric myExitPrice;
Begin
AvgValue1 = AverageFC(Close[1],Length2);
A=AvgTrueRange(Length) ;
If(MarketPosition == 0)
{
If(c[1]>AvgValue1+2*A and Close[1]-Open[1]>0.25*A )
{
myEntryPrice = o;
Buy(0,myEntryPrice) ;
}
If(c[1]<AvgValue1-2*A and Open[1]-Close[1]>0.25*A )
{
myEntryPrice = o;
SellShort(0,myEntryPrice);
}
}
If(MarketPosition == 1)
{
If(c[1] < AvgValue1)
{
myEntryPrice = o;
Sell(0,myEntryPrice);
}
Else
{
If(c[1]>= lastEntryPrice + 2*A and TurtleUnits>=1)
{
myEntryPrice = o;
Buy(1,myEntryPrice);
}
If(c[1] <= lastEntryPrice - 4*A )
{
myExitPrice = o;
Sell(0,myExitPrice);
}
}
}
If(MarketPosition == -1)
{
If(Close[1]>AvgValue1)
{
myEntryPrice = o;
BuyToCover(0,myEntryPrice);
}
Else
{
If(c[1]< lastEntryPrice - 2*A and TurtleUnits>=1)
{
myEntryPrice = o;
SellShort(1,myEntryPrice);
}
If(c[1] >= lastEntryPrice + 4*A )
{
myExitPrice = o;
BuyToCover(0,myExitPrice);
}
}
}
End
|
|