发表于:2005-02-16 06:01只看该作者
2楼
这个Snap1.gif
遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
● 如何使用WinMTR查询平台连接流畅度
发表于:2005-02-16 12:50只看该作者
4楼
其实,mt4中的这个kdj指标不是经典的(或者说我们国内常用的)kdj
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1);
D:SMA(K,M2,1);
J:3*K-2*D;
mt中的两根线只相当于上面的rsv和k。
发表于:2005-02-16 13:00只看该作者
5楼
我只会再增加两根,但是kdj指标又变成4根,有高手能再修改一下:把第一根线只显示数值而不显示线或者把第一根线隐藏!
搞个投机取巧:把第一根线的颜色设成和底色一样的黑色,这样就可以凑合着用。:))
[ Last edited by jxq168 on 2005-2-16 at 21:06 ]
发表于:2005-02-16 13:03只看该作者
6楼
不好玩啊,没法上传?
对不起,不支持上传此类扩展名的附件,请返回修改。
发表于:2005-02-16 13:05只看该作者
7楼
//+------------------------------------------------------------------+
//| KDJ.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Black
#property indicator_color2 Silver
#property indicator_color3 Yellow
#property indicator_color4 Magenta
//---- input parameters
extern int KPeriod=9;
extern int DPeriod=3;
extern int JPeriod=3;
double ind_buffer1;
double ind_buffer2;
double ind_buffer3;
double ind_buffer4;
double HighesBuffer;
double LowesBuffer;
int draw_begin1=0;
int draw_begin2=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 2 additional buffers are used for counting.
IndicatorBuffers(6);
SetIndexBuffer(4, HighesBuffer);
SetIndexBuffer(5, LowesBuffer);
SetIndexBuffer(0, ind_buffer1);
//---- indicator lines
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1, ind_buffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, ind_buffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3, ind_buffer4);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("KDJ("+KPeriod+","+DPeriod+","+JPeriod+")");
SetIndexLabel(1,"K");
SetIndexLabel(2,"D");
SetIndexLabel(3,"J");
//----
draw_begin1=KPeriod+JPeriod;
draw_begin2=draw_begin1+DPeriod;
SetIndexDrawBegin(0,draw_begin1);
SetIndexDrawBegin(1,draw_begin2);
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double price;
//----
if(Bars<=draw_begin2) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=draw_begin1;i++) ind_buffer1[Bars-i]=0;
for(i=1;i<=draw_begin2;i++) ind_buffer2[Bars-i]=0;
}
//---- minimums counting
i=Bars-KPeriod;
if(counted_bars>KPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
double min=1000000;
k=i+KPeriod-1;
while(k>=i)
{
price=Low[k];
if(min>price) min=price;
k--;
}
LowesBuffer=min;
i--;
}
//---- maximums counting
i=Bars-KPeriod;
if(counted_bars>KPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
double max=-1000000;
k=i+KPeriod-1;
while(k>=i)
{
price=High[k];
if(maxdraw_begin1) i=Bars-counted_bars-1;
while(i>=0)
{
double sumlow=0.0;
double sumhigh=0.0;
for(k=(i+JPeriod-1);k>=i;k--)
{
sumlow+=Close[k]-LowesBuffer[k];
sumhigh+=HighesBuffer[k]-LowesBuffer[k];
}
if(sumhigh==0.0) ind_buffer1=100.0;
else ind_buffer1=sumlow/sumhigh*100;
i--;
}
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
//---- signal line is simple movimg average
for(i=0; i
发表于:2005-02-16 13:46只看该作者
8楼
Well done. Perfect!
互相学习、促进交流、共同提高。
发表于:2005-02-16 13:50只看该作者
9楼
Originally posted by 风雨无阻 at 2005-2-16 21:46 Well done. Perfect!
发表于:2005-02-16 14:13只看该作者
10楼
#property indicator_buffers 4
#property indicator_color1 Black
double ind_buffer4;
SetIndexBuffer(0, ind_buffer1);
改一下这些句子,然后把曲线的序号重新安排一下,再试试看看行不行?
[ Last edited by 风雨无阻 on 2005-2-16 at 22:16 ]
互相学习、促进交流、共同提高。
发表于:2005-02-17 00:45只看该作者
11楼
不错!
发表于:2005-02-17 03:36只看该作者
12楼
Originally posted by 风雨无阻 at 2005-2-16 22:13 #property indicator_buffers 4 #property indicator_color1 Black double ind_buffer4; SetIndexBuffer(0, ind_buffer1); 改一下这些句子,然后把曲线的序号重新安排一下,再试试看看行不 ...
发表于:2005-02-17 11:55只看该作者
13楼
应要求贴个图,没别的意思。未命名.JPG
14楼
多谢两位
韬客社区www.talkfx.co
发表于:2005-05-30 02:05只看该作者
15楼
谁能把成品的代码贴上来?
遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
● 如何使用WinMTR查询平台连接流畅度
发表于:2005-05-30 04:40只看该作者
16楼
//+------------------------------------------------------------------+
//| KDJ.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Magenta
//Aqua
//---- input parameters
extern int KPeriod=9;
extern int DPeriod=3;
extern int JPeriod=3;
double ind_buffer1;
double ind_buffer2;
double ind_buffer3;
double ind_buffer4;
double HighesBuffer;
double LowesBuffer;
int draw_begin1=0;
int draw_begin2=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 2 additional buffers are used for counting.
IndicatorBuffers(6);
SetIndexBuffer(4, HighesBuffer);
SetIndexBuffer(5, LowesBuffer);
SetIndexBuffer(3, ind_buffer1);
//---- indicator lines
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0, ind_buffer2);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1, ind_buffer3);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, ind_buffer4);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("KDJ("+KPeriod+","+DPeriod+","+JPeriod+")");
SetIndexLabel(1,"K");
SetIndexLabel(2,"D");
SetIndexLabel(3,"J");
//----
draw_begin1=KPeriod+JPeriod;
draw_begin2=draw_begin1+DPeriod;
SetIndexDrawBegin(0,draw_begin1);
SetIndexDrawBegin(1,draw_begin2);
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double price;
//----
if(Bars<=draw_begin2) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=draw_begin1;i++) ind_buffer1[Bars-i]=0;
for(i=1;i<=draw_begin2;i++) ind_buffer2[Bars-i]=0;
}
//---- minimums counting
i=Bars-KPeriod;
if(counted_bars>KPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
double min=1000000;
k=i+KPeriod-1;
while(k>=i)
{
price=Low[k];
if(min>price) min=price;
k--;
}
LowesBuffer=min;
i--;
}
//---- maximums counting
i=Bars-KPeriod;
if(counted_bars>KPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
double max=-1000000;
k=i+KPeriod-1;
while(k>=i)
{
price=High[k];
if(maxdraw_begin1) i=Bars-counted_bars-1;
while(i>=0)
{
double sumlow=0.0;
double sumhigh=0.0;
for(k=(i+JPeriod-1);k>=i;k--)
{
sumlow+=Close[k]-LowesBuffer[k];
sumhigh+=HighesBuffer[k]-LowesBuffer[k];
}
if(sumhigh==0.0) ind_buffer1=100.0;
else ind_buffer1=sumlow/sumhigh*100;
i--;
}
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
//---- signal line is simple movimg average
for(i=0; i
韬客社区www.talkfx.co
发表于:2005-05-30 04:41只看该作者
17楼
以上的代码已经调试过了。
韬客社区www.talkfx.co
发表于:2005-05-30 04:53只看该作者
18楼
谢谢哈 建议贴代码的时候 看看这个帖子
http://www.talkfx.com/viewthread.php?tid=46049
遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
● 如何使用WinMTR查询平台连接流畅度
发表于:2005-05-30 20:22只看该作者
19楼
Originally posted by jxq168 at 2005-2-17 11:36 谢谢,修改成功!
发表于:2005-05-30 23:51只看该作者
20楼
解压后
放入
MetaTrader 4\experts\indicators 目录里面
关闭mt4 从新打开
然后在导航的自定义指标里就可以找到了
或者
在 插入 技术指标 自定义指标 里面找到 talkforex-kdj-by-MayMay.mq4 这个指标 点击后就会出现图了
[ 本帖最后由 老正 于 2005-11-9 15:31 编辑 ]talkforex-kdj-by-MayMay.zip
遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
● 如何使用WinMTR查询平台连接流畅度