打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
关于MT4里BIAS的问题
MT4里一般的乖离率公式如下:
/+------------------------------------------------------------------+
//|                                              BIAS-乖离率指标.mq4 |
//|                                                 FXLong技术部编写 |
//|                                           http://www.fxlong.com/ |
//+------------------------------------------------------------------+
#property copyright  "一条龙外汇网:www.fxlong.com"
#property  link      "http://www.fxlong.com/"

//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Orange
#property  indicator_color2  Turquoise
#property  indicator_color3  CornflowerBlue

//---- Level Lines
#property indicator_level1 0

//---- indicator parameters
extern int MA1=6;
extern int MA2=12;
extern int MA3=24;
//---- indicator buffers
double     MA1Buffer[];
double     MA2Buffer[];
double     MA3Buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   
   SetIndexDrawBegin(0,MA1);
   SetIndexDrawBegin(1,MA2);
   SetIndexDrawBegin(2,MA3);   
   
   IndicatorDigits(Digits+1);
   
//---- indicator buffers mapping
   SetIndexBuffer(0,MA1Buffer);
   SetIndexBuffer(1,MA2Buffer);
   SetIndexBuffer(2,MA3Buffer);
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("BIAS("+MA1+","+MA2+","+MA3+")");
   SetIndexLabel(0,"BIAS");
   SetIndexLabel(1,"BIAS");
   SetIndexLabel(2,"BIAS");
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- bias counted in the 1-st buffer
   for(int i=0; i<limit; i++)
   {   
      MA1Buffer= 100*(Close- iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,MA1,0,MODE_SMA,PRICE_CLOSE,i);
      MA2Buffer= 100*(Close- iMA(NULL,0,MA2,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,MA2,0,MODE_SMA,PRICE_CLOSE,i);
      MA3Buffer= 100*(Close- iMA(NULL,0,MA3,0,MODE_SMA,PRICE_CLOSE,i))/iMA(NULL,0,MA3,0,MODE_SMA,PRICE_CLOSE,i);
   }

//---- done
   return(0);
  }
//+------------------------------------------------------------------+

都是以Close的ma计算的 我想变为以(H+L)/2的smoothed计算的均线乖离
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
MT4源码
看MT4代码,学编程 一
会变色的均线
MT4编程初级手册(10):一条指标线的实例
MT4实例荟萃(入门者整理)
MT4外汇交易时间限制功能 (转帖)——水行三界 水,因势而汹涌,因容而浩瀚。——东方财富...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服