mt4平台3线kdj指标_三线tⅹt下载

mt4平台3线kdj指标_三线tⅹt下载在MT4上,是没有三线KDJ指标的,分享KDJ指标源码:#propertycopyright”Copyright2020″#propertylink”https://www.mql5.com”#propertyversion”1.00″#propertystrict#propertyindicator_separate_window#propertyindicator_buffers3#propertyindicator_plots3//—p

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

在MT4上,是没有三线KDJ指标的,分享KDJ指标源码:

#property copyright "Copyright 2020"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots 3
//--- plot KLine
#property indicator_label1 "KLine"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrWhite
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- plot DLine
#property indicator_label2 "DLine"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrGold
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
//--- plot JLine
#property indicator_label3 "JLine"
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrDarkViolet
#property indicator_style3 STYLE_SOLID
#property indicator_width3 1

#property indicator_levelstyle STYLE_DOT
#property indicator_levelcolor clrSilver
#property indicator_level1 0
#property indicator_level2 20
#property indicator_level3 50
#property indicator_level4 80
#property indicator_level5 100


//---- input parameters
input int N =9;//%K 周期
input int M1=3;//%D 周期
input int M2=3;//慢速
//--- indicator buffers
double         KBuffer[];
double         DBuffer[];
double         JBuffer[];
double llv[],hhv[],rsv[];
double p=0,p1=0;
double f=0,f1=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
  { 
   
//--- indicator buffers mapping
   IndicatorBuffers(6);
   SetIndexBuffer(0,KBuffer);
   SetIndexBuffer(1,DBuffer);
   SetIndexBuffer(2,JBuffer);
   SetIndexBuffer(3,llv,INDICATOR_CALCULATIONS);
   SetIndexBuffer(4,hhv,INDICATOR_CALCULATIONS);
   SetIndexBuffer(5,rsv,INDICATOR_CALCULATIONS);

   for(int i=0; i<6; i++)
     { 
   
      SetIndexDrawBegin(i,N+M1+M2);
     }


   SetLevelValue(0,0);
   SetLevelValue(1,20);
   SetLevelValue(2,50);
   SetLevelValue(3,80);
   SetLevelValue(4,100);

   string name = "KDJ("+ (string)N+","+(string)M1+","+(string)M2+")";
   IndicatorShortName(name);

   IndicatorDigits(2);

   if(N<=0||M1<=0||M2<=0)
      return(INIT_FAILED);

   p = 1.0/M1;
   p1 = 1-p;
   f = 1.0/M2;
   f1 = 1-f;



//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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=0;
   if(rates_total<=0)
      return(0);
   if(prev_calculated<=0)
      limit=rates_total-1;
   else
      limit = rates_total - prev_calculated +1;

   for(i=limit; i>=0; i--)
     { 
   
      llv[i]=0;
      hhv[i]=0;
      if(i>rates_total-N)
         continue;
      int shift = iLowest(NULL,0,MODE_LOW,N,i);
      llv[i] =  low[shift];
      shift = iHighest(NULL,0,MODE_HIGH,N,i);
      hhv[i] = high[shift];
     }
   for(i=limit; i>=0; i--)
     { 
   
      rsv[i] = 0;
      if(hhv[i]>0 && llv[i]>0 && (hhv[i]-llv[i])!=0)
         rsv[i] = (close[i]-llv[i])/(hhv[i]-llv[i])*100;
     }

   for(i=limit; i>=0; i--)
     { 
   
      if(i==rates_total-1)
         KBuffer[i]=0;
      else
        { 
   
         KBuffer[i] = rsv[i]*p + KBuffer[i+1]*p1;
        }
     }

   for(i=limit; i>=0; i--)
     { 
   
      if(i==rates_total-1)
         DBuffer[i]=0;
      else
        { 
   
         DBuffer[i] = KBuffer[i]*f + DBuffer[i+1]*f1;
        }
     }

   for(i=limit; i>=0; i--)
     { 
   
      JBuffer[i] = 3*KBuffer[i] - 2*DBuffer[i];
     }


//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/170487.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 跨域是什么问题_如何实现跨域

    跨域是什么问题_如何实现跨域解决好跨域,让我们愉快的开发吧

    2025年7月14日
    2
  • JWT原理详解_电磁感应现象原理

    JWT原理详解_电磁感应现象原理1.COOKIE使用和优缺点1.1cookie原理:用户名+密码cookie是保存在用户浏览器端,用户名和密码等明文信息1.2session使用原理session是存储在服务器端的一段字符串,相当于字典的key1.用户向服务器发送用户名和密码。2.验证服务器后,相关数据(如用户角色,登录时间等)将保存在当前会话中。3.服务器向用户返回session_id,session信息都会写入到用户的Cookie。4.用户的每个后续请求都将通过在Cookie中取出session_id传给

    2022年4月19日
    47
  • windows 激活状况 命令查询

    windows 激活状况 命令查询slmgr-ipkKey安装产品密钥slmgr-upk卸载密钥slmgr-ato激活密钥sLUI4显示电话激活选项msinfo32查看电脑组件系统详细信息slmgr-skms激活服务器以下又是产品win8版本激活的显示状态:slmgr.vbs-dlv显示:最为详尽的激活信息,包括:激活ID、安装ID、激活截止日期slmgr.vbs-dli显示:…

    2022年5月11日
    50
  • 如何在虚拟机上安装win10系统_虚拟机安装系统的步骤

    如何在虚拟机上安装win10系统_虚拟机安装系统的步骤有些用户为了在自己的win10系统上检测一些软件,通常情况会给自己安装一个xp系统虚拟机,这样也能避免测试程序对于主系统的损害,可是win10安装xp虚拟机怎么做呢?接下来小编就带大家来了解一下win10安装xp虚拟机详细步骤。具体方法:1、首先你得去下载一个想要装载在虚拟机上的系统,一定要下载扩展名为.iso的文件。2、然后再去下载一个VMwareWorkstation的虚拟机安装软件,3、然…

    2022年8月16日
    14
  • pycharm快速安装库_pycharm安装库错误

    pycharm快速安装库_pycharm安装库错误由于pycharm自带的pip源网站是国外网址,这就导致了许多国内用户在pycharm中下载其他软件包速度极慢,有时还会跳出下载失败的界面。因此我们可以将pycharm中的pip源网站更换成我们国内的pip镜像源,这样下载速度就会有质的飞跃。以下是几个比较全面的国内pip镜像源:清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学https://pypi.mir

    2022年8月25日
    7
  • 阿里云社区之新的开始

    阿里云社区之新的开始

    2021年6月13日
    105

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号