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)
上一篇 2022年8月15日 下午12:16
下一篇 2022年8月15日 下午12:36


相关推荐

  • 【教程】OpenClaw(Clawdbot)华为云10分钟搭建及使用喂饭级步骤

    【教程】OpenClaw(Clawdbot)华为云10分钟搭建及使用喂饭级步骤

    2026年3月15日
    3
  • navicat premium 15 激活码 mac【在线注册码/序列号/破解码】「建议收藏」

    navicat premium 15 激活码 mac【在线注册码/序列号/破解码】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月20日
    79
  • 一个QQ空间的钓鱼盗号过程揭露,大家谨防上当[通俗易懂]

    一个QQ空间的钓鱼盗号过程揭露,大家谨防上当[通俗易懂]1.开端很久没有用过QQ空间了,今天突然QQ弹出一条消息,说我的一个好友留言中提到了我,但是我却也打不开这个链接。于是,我就去她的空间留言板查看。发现第一条留言,是一个二维码扫描之后,进入到一个网页,是标准的QQ空间登录页。这么敏感的信息,当然要慎之又慎!我们识别一下这个二维码,发现!他并不是腾讯的域名。如下http://gallatinboom.com/catfish/xxyy….

    2022年8月24日
    7
  • 用html做一个漂亮的网站,个人网页,css

    用html做一个漂亮的网站,个人网页,css多的不说 直接上网页我个人自学的 样子不是恒好看 但是可以作为作业 老师也没怎么讲 毕竟是在大学里面嘛 大部分时间都是自学罢了 这是主页面 index html htmllang en head metacharset UTF 8 metaname viewport content width device width initial scale 1 0 title title metaname viewport content width device width initial scale 1 0 metacharset UTF 8 head htmllang en

    2026年3月19日
    3
  • cpld和fpga区别

    cpld和fpga区别1、cpld执行一次下载编程后,逻辑阵列就被保存下来;fpga断电后逻辑功能不能保存,需要一块配置芯片在上电后对其重新配置。2、cpld擦写次数非常有限(100-1000),而fpga读写次数可以理解为无限次。3、cpld容量较小,fpga容量很大。4、一般调试阶段用fpga,实际产品用cpld。5、cpld保密性好,速度快。https://wenku.baidu.com/…

    2022年6月4日
    68
  • 物联网开发 7 旗点云物联网云平台

    物联网开发 7 旗点云物联网云平台目录一 演示效果 二 手机 APP 和智能网关通信过程 三 设备管理 四 使用旗点云平台五 手机应用程序安装 六 使用我们的提供的 p2p client 客户端测试程序 七 云平台服务器部署 p2p server 八 如何编写自己的嵌入式设备通信程序 1 设置好我们的设备名 2 设置好我们的发送函数 3 登录函数 4 接收数据函数 5 发送数据给设备九

    2026年3月20日
    1

发表回复

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

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