设为首页收藏本站

 找回密码
 注册
楼主: bluefox
打印 上一主题 下一主题

恳请fish0451出手 移植个mt4的好公式--qqe [复制链接]

Rank: 5Rank: 5

精华
0
UID
4250
积分
891
帖子
198
主题
42
阅读权限
60
注册时间
2009-4-28
最后登录
2019-12-1
1#
发表于 2009-11-7 15:21:11 |显示全部楼层

内建函数要修改为

//------------------------------------------------------------------------
// 简称: iRSI
// 名称: iRSI
// 类别: 用户函数
// 类型: 内建函数
// 输出: 数值型
//------------------------------------------------------------------------

Params
        Numeric Length(14) ;

Vars
        NumericSeries NetChgAvg( 0 );
        NumericSeries TotChgAvg( 0 );
        Numeric Change( 0 );
        Numeric SF( 0 );
        Numeric ChgRatio( 0 ) ;
        Numeric iRSIValue;
Begin
        SF = 1/Length;
        If(CurrentBar < Length)
        {
                iRSIValue = InvalidNumeric;
        }Else
        {
                If(CurrentBar == Length)
                {
                        NetChgAvg = ( Close - Close[Length] ) / Length ;
                        TotChgAvg = AverageFC( Abs( Close - Close[1] ), Length ) ;
                }
               
                If(CurrentBar>length)
                {
                        Change = Close - Close[1] ;
                        NetChgAvg = NetChgAvg[1] + SF * ( Change - NetChgAvg[1] ) ;
                        TotChgAvg = TotChgAvg[1] + SF * ( Abs( Change ) - TotChgAvg[1] ) ;
                }
               
                If( TotChgAvg <> 0 )
                {
                        ChgRatio = NetChgAvg / TotChgAvg ;
                }else
                {
                        ChgRatio = 0 ;
                }
               
                iRSIValue = 50 * ( ChgRatio + 1 ) ;
        }

        Return iRSIvalue;
End

//------------------------------------------------------------------------
// 编译版本        GS2004.06.12
// 用户版本        2009/11/07 14:59
// 版权所有        chengjun1201
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

Rank: 5Rank: 5

精华
0
UID
4250
积分
891
帖子
198
主题
42
阅读权限
60
注册时间
2009-4-28
最后登录
2019-12-1
2#
发表于 2009-11-7 15:45:30 |显示全部楼层
//------------------------------------------------------------------------
// 简称: qqe
// 名称: qqe
// 类别: 技术指标
// 类型: 其它类
// 输出:
//------------------------------------------------------------------------
Params
        Numeric SF(5);                        
        Numeric RSI_Period(14);        
        Numeric rat(4.236);
Vars
        NumericSeries TrLevelSlow(0);        
        NumericSeries AtrRsi(0);        
        NumericSeries MaAtrRsi(0);        
        NumericSeries Rsi(0);
        NumericSeries RsiMa(0);
        Numeric Wilders_Period(0);        
        Numeric dar(0);        
        NumericSeries  smin(0);
    NumericSeries  smax(0);
        NumericSeries p;
        
Begin
        Wilders_Period=RSI_Period * 2 - 1;//   14*2-1
        If(BarStatus==0)
        {
                 TrLevelSlow=0;
         AtrRsi=0;
         MaAtrRsi=0;
         Rsi=0;
         RsiMa=0;
                 p=0;
        }
        if(CurrentBar>RSI_Period)
        {
                Rsi=iRSI(RSI_Period);
                RsiMa=XAverage(Rsi,SF);//将RSI 5周期平均
                AtrRsi=Abs(RsiMa[1] - RsiMa);//前一周期--今周期
                MaAtrRsi=XAverage(AtrRsi,Wilders_Period);
                dar=XAverage(MaAtrRsi,Wilders_Period) * rat;        
                smax=RsiMa+dar;
                smin=RsiMa-dar;

                p=p[1];

                if (RsiMa>smax[1]) {p=1; }         
                if (RsiMa<smin[1]) {p=-1;}

                if(p>0)
          {
                if(smin<smin[1])
                        smin=smin[1];
                TrLevelSlow=smin; //
                if(TrLevelSlow<TrLevelSlow[1])
                        TrLevelSlow=TrLevelSlow[1];//当 TrLevelSlow 慢速线向下运动时  就把昨天的 慢速线 向后传递 。。目的只向上升 不向下走
          }
          Else
          {
                if(smax>smax[1])
                        smax=smax[1];
                TrLevelSlow=smax;
                if(TrLevelSlow>TrLevelSlow[1])
                        TrLevelSlow=TrLevelSlow[1];
          }
                PlotNumeric("RsiMa",RsiMa);
                PlotNumeric("TrLevelSlow",TrLevelSlow);
        }
               

End



//------------------------------------------------------------------------
// 编译版本        GS2004.06.12
// 用户版本        2009/11/07 15:01
// 版权所有        chengjun1201
// 更改声明        TradeBlazer Software保留对TradeBlazer平台
//                        每一版本的TrabeBlazer公式修改和重写的权利
//------------------------------------------------------------------------

使用道具 举报

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

bottom

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

GMT+8, 2024-5-29 01:55

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部