顺水外汇EA交易网MT4

标题: 我也请牛版修改一下指标 [打印本页]

作者: myhaomm    时间: 2018-1-11 11:56
标题: 我也请牛版修改一下指标
这是在论坛里找到的一个掘金者的指标,加载后  走过的K线有些不自动消除,需要重新加载模板或切换下时间才能完整显示,如下图
[attach]17149[/attach]
[attach]17150[/attach]
,请牛版看看源码
//+------------------------------------------------------------------------+
//|                                 Symphonie_Trendline_Indicator_v3.0.mq4 |
//|Based on basic Trendline by MetaTrader_Experts_and_Indicators           |
//+------------------------------------------------------------------------+
#property copyright "Symphonie Trader System"
#property link      "MetaTrader_Experts_and_Indicators"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 DodgerBlue
extern int CCIPeriod=89;
extern int ATRPeriod=1;
double TrendUp[];
double TrendDown[];
int st = 0;
//extern int SlowerEMA = 6;
//+------------------------------------------------------------------+
//| Custom indicator initialization function|
//+------------------------------------------------------------------+
int init()
{
//---- indicators
  SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
  SetIndexBuffer(0, TrendUp);
  SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
  SetIndexBuffer(1, TrendDown);
  /*SetIndexStyle(0, DRAW_ARROW, EMPTY);
  SetIndexArrow(0, 159);
  SetIndexBuffer(0, TrendUp);
  SetIndexStyle(1, DRAW_ARROW, EMPTY);
  SetIndexArrow(1, 159);
  SetIndexBuffer(1, TrendDown);*/
  /*for(int i = 0; i  0) counted_bars--;
  limit=Bars-counted_bars;
  for(i = limit; i >= 0; i--) {
     cciTrendNow = iCCI(NULL, 0, CCIPeriod, PRICE_TYPICAL, i);
     cciTrendPrevious = iCCI(NULL, 0, CCIPeriod, PRICE_TYPICAL, i+1);
     //st = st * 100;
     counter = i;
     Range = 0;
     AvgRange = 0;
     for (counter = i; counter >= i-9; counter--) {
        AvgRange = AvgRange + MathAbs(Low[counter]-High[counter]);
     }
     Range = AvgRange/10;
     if (cciTrendNow >= st && cciTrendPrevious  st) {
        TrendDown[i+1] = TrendUp[i+1];
     }
     if (cciTrendNow >= st) {
        TrendUp = Close - iATR(NULL, 0, ATRPeriod, i);
        if (TrendUp  TrendDown[i+1]) {
           TrendDown = TrendDown[i+1];
        }
     }
  }
//----
//----
  return(0);
}
//+------------------------------------------------------------------+

作者: stefanlife    时间: 2018-1-11 12:27
帮你顶了
作者: stefanlife    时间: 2018-1-11 13:45
帮你顶了
作者: nanaliu    时间: 2018-1-11 14:19
顶顶顶顶。。。。
作者: hjsn2025    时间: 2018-1-11 15:51
不错,还好你有源码

作者: ferrari0078    时间: 2018-1-11 17:08
还好你有源码..
作者: 凡人凡事    时间: 2018-1-11 18:09
谢谢楼主分享!!!!!
作者: XGLONG    时间: 2018-1-11 19:44
不错,还好你有源码
作者: 福相随    时间: 2018-1-11 20:10
伸手习惯了,慢慢我的习气就变坏了




欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/) Powered by Discuz! X3.2