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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • vue 文件上传至服务器_oss文件服务器

    vue 文件上传至服务器_oss文件服务器为什么使用对象存储OSS很多企业的文件上传下载都是通过文件流的形式进行上传下载的,需要后端配合,对服务器压力很大,而且高消费,对公司损失太大,我们选择使用oss将尽可能地缩小成本,以及对网站及逆行大幅度提升使用对象存储OSS改变了什么网站数据动静分离,大幅提升网页性能 单独的文件管理界面,管理网站文件和本地电脑一样高效率方便使用 成本低,资源弹性伸缩,按需付费什么是对象存储OSS阿里云对象存储OSS(ObjectStorageService)是一款海量、安全、低成本、高可靠的云存储

    2022年8月15日
    7
  • jdbc的增删改查_netbeans数据库增删改查

    jdbc的增删改查_netbeans数据库增删改查JBDC数据的持久化:把数据保存到磁盘上。JDBC是java访问数据库的基石,JDO,Hibernate,Mybatis等都是基于JDBCJDBC是一个独立于特定数据库的管理系统,通用的SQL数据库存取和操作的公共接口配置文件:jdbc.propertiesuser=rootpassword=abc123url=jdbc:mysql://localhost:3306/testdriverClass=com.mysql.jdbc.Driver获取Connectionpublic s

    2022年8月8日
    6
  • 感知机及其R实现

    感知机及其R实现感知机1.感知机模型定义:假设输入空间(特征空间)是χ⊆Rn\chi\subseteqR^n,输出空间是Y={+1,−1}Y=\{+1,-1\}。输入x∈χx\in\chi表示实例的特征向量,对应于输入空间的点;输出y∈Yy\inY表示实例的类别。由输入空间到输出空间的如下函数f(x)=sign(w⋅x+b)f(x)=sign(w\cdotx+b)称为感知机。其中,ww和bb为感知

    2022年8月30日
    1
  • 深度学习的深度和宽度的理解[通俗易懂]

    深度学习的深度和宽度的理解[通俗易懂]文章目录1.深度1.1为什么加深可以提升性能1.1.1更好拟合特征1.1.2网络更深,每一层要做的事情也更加简单1.2如何定量评估深度与模型性能1.2.1直接法1.2.2间接法1.3加深就一定更好吗?1.3.1加深带来的优化问题1.3.2网络加深带来的饱和2.宽度2.1为什么需要足够的宽度2.2网路到底需要多宽2.2.1网络宽度的下限在哪?2.2.2网络宽度对模型性能的影响2.2.3网络宽度和深度哪个更重要?2.3如何更加有效地利用宽度2.3.1提高每一层的通道的利用率

    2022年5月11日
    70
  • Java开发手册之 ORM映射

    Java开发手册之 ORM映射Java开发手册之 ORM映射

    2022年4月22日
    40
  • Java二叉树前序遍历[通俗易懂]

    Java二叉树前序遍历[通俗易懂]给你二叉树的根节点root,返回它节点值的前序遍历。示例1:输入:root=[1,null,2,3]输出:[1,2,3]示例2:输入:root=[]输出:[]示例3:输入:root=[1]输出:[1]示例4:输入:root=[1,2]输出:[1,2]示例5:输入:root=[1,null,2]输出:[1,2]提示:树中节点数目在范围[0,100]内-100<=Node.val<=100进阶:递归算法很简单

    2025年9月23日
    3

发表回复

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

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