[求助]麻烦老师帮我把TB这个指标转成文华语言,谢谢 (文华财经)

投资者咨询:[求助]麻烦老师帮我把TB这个指标转成文华语言,谢谢 (文华财经)
来源:文华财经  日期:2021-1-23 20:53
 Params
        Numeric SF(5);                        
        Numeric RSI_Period(14);        
        Numeric rat(3);//
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;//Wilders周期
        If(BarStatus==0)
        {
                 TrLevelSlow=0;
         AtrRsi=0;
         MaAtrRsi=0;
         Rsi=0;
         RsiMa=0;
                 p=0;
        }
        if(CurrentBar>RSI_Period)
        {
                //Rsi=iRSI(Close,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];
          } 
          Else
          {
                if(smax>smax[1]) 
                        smax=smax[1];
                TrLevelSlow=smax; 
                if(TrLevelSlow>TrLevelSlow[1])
                        TrLevelSlow=TrLevelSlow[1];
          }
                PlotNumeric("RsiMa",RsiMa);
                PlotNumeric("TrLevelSlow",TrLevelSlow);
        }

End 

   
技术人员回复
日期:2021-1-24 9:46
irsi应该是一个自定义函数,需要您提供irsi函数的算法才能进行改写。

另外,WH9兼容了TB语法,您的指标需要在WH9上使用,

WH9是收费软件,文华官网下载:



  
 
投资者咨询:[求助]麻烦老师帮我把TB这个指标转成文华语言,谢谢 (文华财经)
来源:文华财经  日期:2021-1-23 20:53
 老师,辛苦抽点时间改一下
技术人员回复
日期:2021-1-24 13:54
 参考2楼回复。