天猫首页
当前位置: 首页 > 趋势EA > 【MACD】变色MACD

浏览历史

【MACD】变色MACD
prev zoom next

【MACD】变色MACD

  • 本店售价:¥5000元 ¥8000元
  • 商品货号:ECS003644
  • 商品库存: 9999
  • 上架时间:2022-09-15
  • 商品点击数:2

商品描述

商品属性

商品标签

相关商品

//+------------------------------------------------------------------+
//|                                      macdbs.mq4 |
//|                 Copyright 2021, MetaQuotes Software Corp. |
//|                               https://www.mql5.com |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Green
#property indicator_color3 Red
//--- buffers
double   ExtMacdBuffer[];
double   ExtUpBuffer[];
double   ExtDnBuffer[];
//---
#define PERIOD_FAST 12
#define PERIOD_SLOW 26
//--- bars minimum for calculation
#define DATA_LIMIT 34
//+------------------------------------------------------------------+
//| Custom indicator initialization function                  |
//+------------------------------------------------------------------+
void OnInit(void)
 {
//--- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,DATA_LIMIT);
   SetIndexDrawBegin(1,DATA_LIMIT);
   SetIndexDrawBegin(2,DATA_LIMIT);
//--- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtMacdBuffer);
   SetIndexBuffer(1,ExtUpBuffer);
   SetIndexBuffer(2,ExtDnBuffer);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName( MACD
   IndicatorShortName( MACD( +IntegerToString(PERIOD_FAST)+ , +IntegerToString(PERIOD_SLOW)+ )
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
 }
//+------------------------------------------------------------------+
//| Awesome Oscillator                               |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
            const int prev_calculated,
            const datetime time[],
            const double open[],
            const double high[],
            const double low[],
            const double close[],
            const long tick_volume[],
            const long volume[],
            const int spread[])
 {
   int    i,limit=rates_total-prev_calculated;
   double prev=0.0,current;
//--- check for rates total
   if(rates_total =DATA_LIMIT)
     return(0);
//--- last counted bar will be recounted
   if(prev_calculated 0)
   {
     limit++;
     prev=ExtMacdBuffer[limit];
   }
//--- macd
   for(i=0; i limit; i++)
     ExtMacdBuffer[i]=iMA(NULL,0,PERIOD_FAST,0,MODE_EMA,PRICE_CLOSE,i)-
               iMA(NULL,0,PERIOD_SLOW,0,MODE_EMA,PRICE_CLOSE,i);
//--- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i i--)
   {
     current=ExtMacdBuffer[i];
     if(current prev)
       up=true;
     if(current prev)
       up=false;
     if(!up)
     {
       ExtDnBuffer[i]=current;
       ExtUpBuffer[i]=0.0;
     }
     else
     {
       ExtUpBuffer[i]=current;
       ExtDnBuffer[i]=0.0;
     }
     prev=current;
   }
//--- done
   return(rates_total);
 }
//+------------------------------------------------------------------+
商品属性
[]

商品标签

购买记录(近期成交数量0)

还没有人购买过此商品
总计 0 个记录,共 1 页。 第一页 上一页 下一页 最末页

用户评论(共0条评论)

  • 暂时还没有任何用户评论
总计 0 个记录,共 1 页。 第一页 上一页 下一页 最末页
用户名: 匿名用户
E-mail:
评价等级:
评论内容:
验证码: captcha
在线咨询