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


相关推荐

  • TCP/IP协议四层模型

    TCP/IP协议四层模型接下来的学习重心会放在Linux网络编程这一块,我的博客也会随之更新。参照的书籍有《Linux高性能服务器编程》(游双著)、《UNIX网络编程-卷1:套接字联网API》。  TCP/IP协议族是一个四层协议系统:1.数据链路层  1.1作用  (1)实现网卡接口的网络驱动,以处理数据在以太网线等物理媒介上的传输  (2)网络驱动程序隐藏了不同物理网络的不同电气特性,为上层协议提供一个

    2022年6月29日
    25
  • 电脑关闭445端口_计算机端口在哪里设置

    电脑关闭445端口_计算机端口在哪里设置win7关闭445端口命令是什么?在我们使用的windows7旗舰版操作系统中默认开启了445端口,这个端口会遭到病毒的攻击,所以我们需要将其关闭。本文中winwin7小编给大家分享介绍下使用cmd命令提示符来关闭445端口的详细操作方法,有需要的用户快参考下面步骤来设置关闭445端口吧!455端口关闭教程:1、首先我们来看看当前系统都开放了那些端口,使用快捷键Win+R调出运行窗口,输入cmd…

    2022年10月9日
    0
  • Pycharm写Python脚本 | Python新建文件自动注释

    Pycharm写Python脚本 | Python新建文件自动注释Pycharm写Python脚本|Python新建文件自动注释效果如图所示:1.打开Pycharm,点击File,选择Settings2.点击Editor,选择里面的FileandCodeTemplates,找到并点击PythonScript3.在右侧空白处输入代码#@Time:${DATE}${TIME}#@Author:SHAUN#@File:${NAME}.py#Software:${PRODUCT_NAME}其中:${DATE}表示当前

    2025年6月7日
    0
  • Flash停止支持?不用愁!![通俗易懂]

    Flash停止支持?不用愁!![通俗易懂]2020年的最后一天,Flash华丽谢幕与我们告别……作为一名4399的忠实玩家,真是心痛不已……所以,今天告诉大家几种让Flash重新工作的方式:1.安装“中国版Flash”:目前,中国已经

    2022年8月1日
    9
  • sql语句大全+实例讲解「建议收藏」

    sql语句大全+实例讲解「建议收藏」1.创建3张表//学生表创建CREATEtablestudent(SnoCHAR(9)PRIMARYKEY,SnameCHAR(20)UNIQUE,Ssexchar(2),SageSMALLINT,Sdeptchar(20));//课程表创建CREATEtablecourse(Cnochar(4)PRIMARYKEY,Cnamechar(40)notNULL,Cpnochar(4),CcreditSMALLINT);//学生选课表创

    2022年5月12日
    49
  • 如何在Ubuntu 20.04 LTS上安装Microsoft Edge?

    如何在Ubuntu 20.04 LTS上安装Microsoft Edge?在本教程中,我们将向您展示如何在香港服务器www.a5idc.net的Ubuntu20.04LTS系统上安装MicrosoftEdge。微软已经发布了EdgeforLinux的第一个测试版本

    2022年7月4日
    24

发表回复

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

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