在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
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/115320.html