根據海龜修改的簡單均線系統,請大家幫忙給看看
作者:開拓者 TB 來源:cxh99.com 發布時間:2014年12月02日
- 咨詢內容:
本帖最后由 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
- TB技術人員:
實測圖貼一個?