HAWKIE请进
请问您能把这个修改过的KDJ指标编成MT4适用的吗?这个主要是KDJ指标加了一个多天平均线,又把J作了一下2天的简单平均
DXQS巧手 {短线巧手}
{P1-13 N-9 M1-3 M2-3}
AA:=LLV(LOW,36);
BB:=HHV(HIGH,30);
DD:=EMA((CLOSE-AA)/(BB-AA)*4,4) *25 ;
PP:=SMA(DD,P1,1);
巧手:PP,COLORRED,LINETHICK2 ;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:SMA(K,M2,1);
J:MA(( 3*K-2*D),2);
天:105; 界:50;
预备:18; 地:0; 警戒: 87.5,COLORGRAY;
partline(巧手,巧手>ref(巧手,1),rgb(255,0,0),巧手ref(j,1),rgb(255,0,255),j
发表于:2005-06-22 01:59只看该作者
2楼
不知道编对没有。红色的是巧手线。
//+------------------------------------------------------------------+
//| TALKFOREX-DXQS.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 Silver
#property indicator_color2 Yellow
#property indicator_color3 Magenta
#property indicator_color4 Red
//---- input parameters
extern int P=13;
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 ind_buffer5;
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(7);
SetIndexBuffer(0, ind_buffer2);
SetIndexBuffer(1, ind_buffer3);
SetIndexBuffer(2, ind_buffer4);
SetIndexBuffer(3, ind_buffer1);
SetIndexBuffer(4, ind_buffer5);
SetIndexBuffer(5, HighesBuffer);
SetIndexBuffer(6, LowesBuffer);
//---- 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);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3, ind_buffer5);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("DXQS("+","+P+","+KPeriod+","+DPeriod+","+JPeriod+")");
SetIndexLabel(0,"K");
SetIndexLabel(1,"D");
SetIndexLabel(2,"J");
SetIndexLabel(3,"QS");
//----
draw_begin1=KPeriod+JPeriod;
draw_begin2=draw_begin1+DPeriod;
SetIndexDrawBegin(0,draw_begin1);
SetIndexDrawBegin(1,draw_begin2);
SetIndexDrawBegin(2,draw_begin2);
SetIndexDrawBegin(3,P);
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double price;
double AA,BB,DD,Buffer;
//----
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=0)
{
AA=High[Highest(NULL,0,MODE_HIGH,30,i)];
BB=Low[Lowest(NULL,0,MODE_LOW,36,i)];
Buffer=(Close-AA)/(BB-AA)*4;
DD=iMAOnArray(Buffer,0,4,0,MODE_EMA,0)*25;
ind_buffer5=iMAOnArray(DD,0,P,0,MODE_SMMA,0);
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
3楼
太好了真没想到这么快就编好了,
我这就试试
谢谢.
韬客社区www.talkfx.co
4楼
多谢HAWKIE,第一个图是编过后的指标图,K。D。J三个值都对,总是感觉巧手线有些不对,第二个图中的巧手线是较平缓的,请您再费心看看好吗?Image00018.gifImage00019.gif
韬客社区www.talkfx.co
5楼
上面第二个图看不清再发一个746_eeNMWuHaAdnD.jpg
韬客社区www.talkfx.co
6楼
让您费心了。多谢
韬客社区www.talkfx.co
发表于:2005-06-22 07:09只看该作者
7楼
正在查问题,不过问题基本搞清楚,还得等一下
8楼
多谢HAWKIE。
韬客社区www.talkfx.co
发表于:2005-06-23 09:13只看该作者
9楼
这个还要等一下,metatrader公式里面有数组个数限制,现在想办法怎么绕过去。^_^
10楼
多谢您,费心了.
韬客社区www.talkfx.co
发表于:2005-07-09 17:33只看该作者
13楼
mt3和mt4的变成,包括指标和EA(expert),有什么程序基础上手比较容易?
还有Hawkie,你对mt3的EA转成MT4的这方面熟悉么?是否有办法编一个mt3 to mt4的转换器,谢谢。
韬客社区www.talkfx.co
14楼
HAWKIE兄在吗?
韬客社区www.talkfx.co
发表于:2005-07-24 00:07只看该作者
15楼
好
发表于:2005-07-24 04:20只看该作者
16楼
原帖由 shwlm 于 2005-7-10 00:58 发表 请问HAWKIE能否给俺也写个MT3用的公式?
韬客外汇论坛
发表于:2005-07-24 04:23只看该作者
17楼
原帖由 Zukunft 于 2005-7-10 01:33 发表 mt3和mt4的变成,包括指标和EA(expert),有什么程序基础上手比较容易? 还有Hawkie,你对mt3的EA转成MT4的这方面熟悉么?是否有办法编一个mt3 to mt4的转换器,谢谢。
发表于:2005-07-24 04:24只看该作者
18楼
原帖由 黑狼 于 2005-7-18 16:33 发表 HAWKIE兄在吗?
发表于:2005-07-25 00:00只看该作者
19楼
公式算法在最上面。
由于mt对于公式变量有数量限制,所以公式需要分成两个部分,或许优化后可以归到一个公式中,
不过暂时就先这样。
下面是公式第一部分。注意,这个公式在mt中保存的名字必须为DXQS-QS,若为其他名字,调用时
会出错。
//+------------------------------------------------------------------+
//| DXQS-QS.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 1
#property indicator_color1 Silver
extern int P=13;
extern int QSHigh=30;
extern int QSLow=36;
double AA;
double BB;
double CC;
double DD;
double EE;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(5);
SetIndexBuffer(0, EE);
SetIndexBuffer(1, AA);
SetIndexBuffer(2, BB);
SetIndexBuffer(3, CC);
SetIndexBuffer(4, DD);
//---- indicator lines
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0, EE);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("DXQS-QS("+","+P+","+QSHigh+","+QSLow+")");
SetIndexLabel(0,"QS");
//----
SetIndexDrawBegin(0,MathMax(QSLow,QSHigh));
return(0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,limit;
//----
limit=Bars-MathMax(QSLow,QSHigh);
for(i=0;i
发表于:2005-07-25 00:03只看该作者
20楼
现在是公式第二部分。mt中需要显示DXQS时,直接调用这个公式的保存名,即可
使用DXQS。
//+------------------------------------------------------------------+
//| DXQS.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 Silver
#property indicator_color2 Yellow
#property indicator_color3 Magenta
//---- input parameters
extern int KPeriod=9;
extern int DPeriod=3;
extern int JPeriod=3;
extern int P=13;
extern int QSHigh=30;
extern int QSLow=36;
double ind_buffer1;
double ind_buffer2;
double ind_buffer3;
double ind_buffer4;
double HighesBuffer;
double LowesBuffer;
double QS;
int draw_begin1=0;
int draw_begin2=0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 2 additional buffers are used for counting.
IndicatorBuffers(7);
SetIndexBuffer(0, ind_buffer3);
SetIndexBuffer(1, ind_buffer4);
SetIndexBuffer(2, QS);
SetIndexBuffer(3, ind_buffer1);
SetIndexBuffer(4, ind_buffer2);
SetIndexBuffer(5, HighesBuffer);
SetIndexBuffer(6, LowesBuffer);
//---- indicator lines
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0, ind_buffer3);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1, ind_buffer4);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, QS);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("DXQS("+KPeriod+","+DPeriod+","+JPeriod+","+P+","+QSHigh+","+QSLow+")");
SetIndexLabel(0,"D");
SetIndexLabel(1,"J");
SetIndexLabel(2,"QS");
//----
draw_begin1=KPeriod+JPeriod;
draw_begin2=draw_begin1+DPeriod;
SetIndexDrawBegin(0,draw_begin1);
SetIndexDrawBegin(1,draw_begin2);
SetIndexDrawBegin(0,MathMax(QSLow,QSHigh));
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