设为首页收藏本站

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

能否将MT4的公式改写成TB的 [复制链接]

Rank: 1

精华
0
UID
3720
积分
29
帖子
2
主题
1
阅读权限
10
注册时间
2009-3-4
最后登录
2019-3-24
跳转到指定楼层
1#
发表于 2010-6-14 21:35:21 |只看该作者 |倒序浏览
由于有些MT4的代码看不懂,求助能否将下面的MT4的公式改写成TB的,谢谢了。
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#property copyright ""

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_width1 2
#property indicator_width2 2
#property indicator_level1 30
#property indicator_level2 70

//
//
//
//
//

   extern int PeriodRSI  =13;
   extern int PeriodStoch= 8;
   extern int PeriodSK   = 5;
   extern int PeriodSD   = 3;
         //    0 = SMA
         //    1 - EMA
         //    2 - SMMA
         //    3 - LWMA
   extern int MAMode=0;

//
//
//
//
//

double SK[];
double SD[];
double StoRSI[];
double RSI[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(4);
      SetIndexBuffer(0,SK);
      SetIndexBuffer(1,SD);
      SetIndexBuffer(2,StoRSI);
      SetIndexBuffer(3,RSI);
   IndicatorShortName("DTOSC ("+PeriodRSI+","+PeriodStoch+","+PeriodSK+","+PeriodSD+")");
return(0);
}
int deinit() { return(0); }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
{
   int i,limit;
   int counted_bars = IndicatorCounted();

   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
             limit=Bars-counted_bars;

   //
   //
   //
   //
   //
            
   for(i=limit; i>=0; i--)
   {
      RSI = iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,i);
      double LLV = RSI[ArrayMinimum(RSI,PeriodStoch,i)];
      double HHV = RSI[ArrayMaximum(RSI,PeriodStoch,i)];
      if ((HHV-LLV)!=0)
            StoRSI = 100.0*((RSI - LLV)/(HHV - LLV));
      else  StoRSI = 0;
   }   
   for(i=limit; i>=0; i--) SK=iMAOnArray(StoRSI,0,PeriodSK,0,MAMode,i);
   for(i=limit; i>=0; i--) SD=iMAOnArray(    SK,0,PeriodSD,0,MAMode,i);
   return(0);
}

附图:
附件: 你需要登录才可以下载或查看附件。没有帐号?注册

Rank: 1

精华
0
UID
3720
积分
29
帖子
2
主题
1
阅读权限
10
注册时间
2009-3-4
最后登录
2019-3-24
2#
发表于 2010-6-16 09:04:12 |只看该作者
郁闷。。。。。。

使用道具 举报

Rank: 5Rank: 5

精华
0
UID
85182
积分
849
帖子
302
主题
11
阅读权限
60
注册时间
2011-12-8
最后登录
2013-10-28
3#
发表于 2011-12-20 17:29:01 |只看该作者
MT4比TB更高级啊  为什么不用MT4呢
http://qpic.cn/NifLLplMk若能一切随它去,便世间自在人。
      ---Derivatives

使用道具 举报

Rank: 1

精华
0
UID
236647
积分
11
帖子
9
主题
0
阅读权限
10
注册时间
2016-6-16
最后登录
2017-8-24
4#
发表于 2016-8-4 15:28:26 |只看该作者
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),13,1)/SMA(ABS(CLOSE-LC),13,1)*100;
AH:=HHV(RSI1,8);
AL:=LLV(RSI1,8);
STO1:=IF(AL=AH,0,100*(RSI1-AL)/(AH-AL));
SK:EMA(STO1,5);
SD:EMA(SK,3);

使用道具 举报

Rank: 1

精华
0
UID
236647
积分
11
帖子
9
主题
0
阅读权限
10
注册时间
2016-6-16
最后登录
2017-8-24
5#
发表于 2016-8-4 15:29:12 |只看该作者
就是用RSI数值代替KDJ指标中的价格

使用道具 举报

Rank: 1

精华
0
UID
244205
积分
45
帖子
30
主题
11
阅读权限
10
注册时间
2016-12-6
最后登录
2022-3-24
6#
发表于 2018-10-20 08:49:20 |只看该作者
如何改呢?

使用道具 举报

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

bottom

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

GMT+8, 2024-5-12 12:40

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部