设为首页收藏本站

 找回密码
 注册
查看: 1798|回复: 1
打印 上一主题 下一主题

根据海龟修改的简单均线系统,请大家帮忙给看看 [复制链接]

Rank: 2

精华
0
UID
4125
积分
99
帖子
20
主题
7
阅读权限
30
注册时间
2009-4-14
最后登录
2020-1-20
跳转到指定楼层
1#
发表于 2014-10-24 13:20:47 |只看该作者 |倒序浏览
本帖最后由 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

Rank: 3Rank: 3

精华
0
UID
187215
积分
125
帖子
35
主题
14
阅读权限
40
注册时间
2014-5-21
最后登录
2022-6-4
2#
发表于 2014-10-29 13:47:12 |只看该作者
实测图贴一个?

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-20 00:18

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部