编码帮助 - 页 287

 
airquest:
你好,我想在缓冲区内提取一个随机数的主线的x个时期的最高值和最低值。我在某处看到,我需要把这些值做成一个数组,但这并不奏效。到目前为止,我还停留在这个代码上。我做得对吗?谁能帮我解决这个问题?非常感谢。请注意。

double num_array[1]={iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,CustomPeriod)};

int gmax=ArrayMaximum(num_array[1],WHOLE_ARRAY,0);

int gmin=ArrayMinimum(num_array[1],WHOLE_ARRAY,0);

MinBuffer=gmin;

MaxBuffer=gmax;

没关系,我找到了答案...。缓冲iStochastic,用ArraySetAsSeries将数值设置在一个序列中,然后对这个序列做ArrayMaximum

 
airquest:
没关系,我找到了答案......对iStochastic进行缓冲,用ArraySetAsSeries将数值设置为一个序列,然后对这个序列进行ArrayMaximum.

替换

ArrayMaximum(num_array[1],WHOLE_ARRAY,0)。

ArrayMinimum(num_array[1],WHOLE_ARRAY,0)。

ArrayMaximum(num_array,WHOLE_ARRAY,0)。

ArrayMinimum(num_array,WHOLE_ARRAY,0)。

 
zigflip:
对不起,是我的错,我把它们混在一起了,而我还在使用正确的版本。 愚蠢的元引号改变了一切

你不是唯一有这种经历的人。

这对用户来说是非常不友好的

 

编码者和破解者,你们好。

我需要您在修改收盘时的ZigZag指标(附件)方面的专业知识。

我需要一个ZigZag on Open来代替(同样的基本设置)。如果可能的话,在新的蜡烛开盘时发出警报将是一个很好的提示。

非常感谢,谢谢

附加的文件:
 
razo:
你好,编码员和破解者。

需要您的专业知识来修改收盘时的ZigZag指标(附件)。

我需要一个ZigZag on Open来代替(同样的基础设置)。如果可能的话,在新的蜡烛开盘时发出警报将是一个很好的提示。

非常感谢,谢谢!

你好,Razo,这就是Zigzag开盘。

附加的文件:
 

嗨,所有的大师们。

我在使用iCustom时遇到了问题,其指标如下所示...#VQ条。

谁能告诉我如何提取以下缓冲区的值....DIR[]

我使用以下代码来提取缓冲区......但没有返回任何值....

double dir=iCustom(NULL,PERIOD_M1, "#VQ bars",4,0) 。

谁能看看这个问题...。

非常感谢您的帮助和协助,.....

#property indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 绿色

#属性 indicator_color2 红色

#属性 indicator_width1 2

#属性 indicator_width2 2 2

Extern int Length = 5;

extern int Method = 3;

extern int Smoothing = 1;

extern int Filter = 5;

extern bool Steady = false;

双重VQ[]。

double SumVQ[];

双DIR[]。

double UpBuffer[];

double DnBuffer[];

//+------------------------------------------------------------------+

int init()

{

IndicatorBuffers(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR)。

如果(Length < 2)Length = 2。

如果(Method < 0) Method = 0;

如果(Method > 3) Method = 3;

如果(Smoothing < 0) Smoothing = 0。

如果(Filter < 0)Filter = 0。

string short_name = "VQ | "+ Length + " , " + Method + " , " + Smoothing = 0

方法 + ", " + 平滑 + ", " + 过滤器 + "| "。

IndicatorShortName(short_name)。

SetIndexEmptyValue(0, 0.0)。

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0)。

返回(0)。

}

//+------------------------------------------------------------------+

int start()

{

double MH = 0, ML = 0, MO = 0, MC = 0, MC1 = 0。

int i, j, limit, counted_bars=IndicatorCounted()。

//----,检查可能的错误

if(counted_bars<0) return(-1);

//---- 最后一个被计数的柱子将被重新计数

如果(counted_bars>0) counted_bars--。

//----

如果(counted_bars<1) i=Bars-Length-1;

否则i=Bars-counted_bars。

如果(counted_bars<1)

{

j=Bars-Length-1。

SumVQ[j + 1] = Close[j + 1]。

}

while (i >= 0)

{

MH = iMA(NULL,0,长度,0,方法,PRICE_HIGH,i)。

ML = iMA(NULL,0,Length,0,Method,PRICE_LOW,i);

MO = iMA(NULL,0,Length,0,Method,PRICE_OPEN,i);

MC = iMA(NULL,0,Length,0,Method,PRICE_CLOSE,i);

MC1 = iMA(NULL,0,Length,0,Method,PRICE_CLOSE,i+Smoothing)。

如果(Steady=true)

{

MC=iMA(NULL,0,Length,0,Method,PRICE_MEDIAN,i);

MC1=iMA(NULL,0,Length,0,Method,PRICE_MEDIAN,i+Smoothing)。

}

如果((MH - ML)>0)

VQ = MathAbs(((MC - MC1) / MathMax(MH - ML, MathMax(MH - MC1, MC1 - ML) )+ (MC - MO) / (MH - ML))* 0.5) * ((MC - MC1 + (MC - MO))* 0.5);

SumVQ = SumVQ + VQ。

如果(Filter > 0)

如果(MathAbs(SumVQ - SumVQ) < Filter * Point)

SumVQ = SumVQ;

i--;

}

如果(counted_bars<1)

limit=Bars-Length-1。

否则limit=Bars-counted_bars。

for (i = limit-1; i >= 0; i--)

{

如果 (SumVQ > SumVQ) DIR = 1;

如果(SumVQ < SumVQ) DIR = -1;

如果(SumVQ==SumVQ)DIR=DIR。

如果(DIR>0)

{

UpBuffer=High。

DnBuffer = Low。

}

否则

如果(DIR < 0)

{

DnBuffer = 高。

UpBuffer = Low。

}

}

return(0);

}

 
12BPRO:
嗨,所有的大师们。

我在使用iCustom时遇到问题,所附的指标如下...#VQ条。

谁能告诉我如何提取以下缓冲区的值....DIR[]

我使用以下代码来提取缓冲区......但没有返回任何值....

double dir=iCustom(NULL,PERIOD_M1, "#VQ bars",4,0) 。

谁能帮我看看这个问题...

非常感谢您的帮助和协助,.....

一切似乎都很好

附上#VQ条以及使用这些数值的测试指标,它显示的数值是正确的

vq_bars.mq4

_test_vq.mq4

附加的文件:
vq_bars.mq4  3 kb
_test_vq.mq4  1 kb
 
mladen:
一切似乎都很好 附上#VQ条以及使用这些值的测试指标,它显示正确的值

vq_bars.mq4

_test_vq.mq4

哇哦...谢谢MLADEN先生....

最奇怪的事情发生了......那段代码在我的指标上不起作用......无法打开错误日志....

但我确实在#VQ条上进行了测试,它工作得很好....

在这上面浪费了几个小时....

我能说什么呢....欠你一个人情....SIR....,为我理清了这个事情.....

这是我的#VQ.....

它有价值,但当我在EA中调用iCustom时,却没有价值....,我可以说....,愚蠢的我....。

附加的文件:
gbpjpy_test.jpg  123 kb
my_vq.jpg  48 kb
 

亲爱的MLADEN先生。

请您看看我的#VQ.... 指标...。我删除了几行我不使用的....,并添加了一些警报....。

我想这就是无法通过iCustom....,在EA中调用缓冲区的问题的原因。

再次非常感谢您的帮助,.....。

谨此

AZRUL.......

#property indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 绿色

#属性 indicator_color2 红色

#perty indicator_width1 2

#属性 indicator_width2 2

Extern int Length = 5;

extern int Method = 3;

Extern int Smoothing = 1;

extern double Filter = 0.5;

extern bool Steady = False;

extern string SoundGbp = "news.wav";

extern string SoundEur = "news.wav";

extern bool PopupAlert = true;

extern bool SendPushNotification = false;

extern bool SoundAlert = True;

int lastAlert=3;

double VQ[];

double SumVQ[];

double DIR[];

double UpBuffer[];

double DnBuffer[];

//+------------------------------------------------------------------+

int init()

{

IndicatorBuffers(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR)。

如果(Length < 2)Length = 2。

如果(Method < 0) Method = 0;

如果(Method > 3) Method = 3;

如果(Smoothing < 0) Smoothing = 0。

如果(Filter < 0)Filter = 0。

string short_name = "VQ | "+ Length + " , " + Method + " , " + Smoothing = 0

方法 + ", " + 平滑 + ", " + 过滤器 + "| "。

IndicatorShortName(short_name)。

SetIndexEmptyValue(0, 0.0)。

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0)。

返回(0)。

}

//+------------------------------------------------------------------+

int start()

{

int i, limit, counted_bars=IndicatorCounted()。

//----,检查可能的错误

if(counted_bars<0) return(-1);

//---- 最后一个被计数的柱子将被重新计数。

如果(counted_bars>0) counted_bars--。

//----

如果(counted_bars<1) i=Bars-Length;

否则i=Bars-counted_bars。

如果(counted_bars<1)

while (i >= 0)

{

VQ = iCustom(NULL,0, "#pollan indy",0,i+1)。

SumVQ= iCustom(NULL,0, "#pollan indy",1,i+1);

//if (Filter > 0)

//if (MathAbs(VQ - SumVQ) < Filter)

//VQ = SumVQ。

i--;

}

如果(counted_bars<1)

limit=Bars-Length-1;

否则limit=Bars-counted_bars。

for (i = limit-1; i >= 0; i--)

{

//如果(VQ > SumVQ) DIR = 1;

如果((VQ+VQ) > (SumVQ+SumVQ))

DIR = 1。

如果((VQ+VQ)<(SumVQ+SumVQ))

DIR = -1。

如果((VQ+VQ) == (SumVQ+SumVQ))

DIR=DIR。

如果(DIR>0)

{

UpBuffer=High。

DnBuffer = Low。

}

否则

如果(DIR < 0)

{

DnBuffer = 高。

UpBuffer = Low。

}

如果((DIR>0)&&(DIR>0))。

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

如果((DIR < 0) && (DIR < 0))

{

CheckForAlerts(OP_SELL);//ALERT SELL

}

}

double vq1=iCustom(NULL,0, "#pollan indy",0,i+1);

double svq1=iCustom(NULL,0, "#pollan indy",1,i+1);

double vq2=iCustom(NULL,0, "#pollan indy",0,i+2);

double svq2=iCustom(NULL,0, "#pollan indy",1,i+2);

double vq3=iCustom(NULL,0, "#pollan indy",0,i+3);

double svq3=iCustom(NULL,0, "#pollan indy",1,i+3);

double dir1=DIR;

double dir2=DIR;

double dir3=DIR。

double vq0= (vq1 + vq2);

double svq0= (svq1 + svq2);

string VQ0_Teks=DoubleToStr(vq0,6);

string VQS0_Teks=DoubleToStr(svq0,6);

string VQ1_Teks=DoubleToStr(vq1,6);

string VQS1_Teks=DoubleToStr(svq1,6);

string VQ2_Teks=DoubleToStr(vq2,6);

string VQS2_Teks=DoubleToStr(svq2,6);

string VQ3_Teks=DoubleToStr(vq3,6);

string VQS3_Teks=DoubleToStr(svq3,6);

string dir1_Teks=DoubleToStr(dir1,6);

string dir2_Teks=DoubleToStr(dir2,6);

string dir3_Teks=DoubleToStr(dir3,6);

字符串h =

"Blue" + " " + VQ0_Teks+ " " + " Red" + " + VQS0_Teks + "n" +

"Blue" + " " + VQ1_Teks+ " " + " Red" + " " + VQS1_Teks + "n" +

"Blue" + " " + VQ2_Teks+ " " + " Red" + " " + VQS2_Teks + " "n" + "

"Blue" + " " + VQ3_Teks+ " " + " Red" + " " + VQS3_Teks + " \n" + " \n" +

"DIR1" + " " + dir1_Teks+ " " + "DIR2" + " " + dir2_Teks + " " +"DIR3" + " " + dir3_Teks。

评论(h)。

return(0);

}

//--------------------------------------------------------------

空白 CheckForAlerts(int type)

{

//ALERTS。

static datetime lastAlertTime=0;

如果(lastAlertTime != iTime(NULL,0,0)) {

如果(type==OP_BUY && lastAlert!=2) { //BUY

doAlerts("Pollan BAR UP "+Symbol()+" (tf: "+Period()+")" ,SoundEur)。

lastAlert=2;

lastAlertTime=iTime(NULL,0,0);

}

如果(type==OP_SELL && lastAlert! =1) { //SELL

doAlerts("Pollan BAR DOWN "+Symbol()+" (tf: "+Period()+")" ,SoundGbp);

lastAlert=1。

lastAlertTime=iTime(NULL,0,0);

}

}//if (lastAlertTime != iTime(NULL,0,0) {

//结束警报器

}

//--------------------------------------------------------------

void doAlerts(string sMsg,string SoundFile) {

如果(PopupAlert) Alert(sMsg);

如果(SoundAlert) PlaySound(SoundFile);

如果(SendPushNotification)SendNotification(sMsg);

}

THANKS........

 
12BPRO:
亲爱的MLADEN先生。

你能不能看看我的#VQ.... 指标...。我删除了几行我不使用的....,并添加了一些警报....。

我想这就是无法通过iCustom....,在EA中调用缓冲区的问题的原因。

再次非常感谢您的帮助,.....。

谨此

AZRUL.......

#property indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 绿色

#属性 indicator_color2 红色

#perty indicator_width1 2

#属性 indicator_width2 2

Extern int Length = 5;

extern int Method = 3;

Extern int Smoothing = 1;

extern double Filter = 0.5;

extern bool Steady = False;

extern string SoundGbp = "news.wav";

extern string SoundEur = "news.wav";

extern bool PopupAlert = true;

extern bool SendPushNotification = false;

extern bool SoundAlert = True;

int lastAlert=3;

double VQ[];

double SumVQ[];

double DIR[];

double UpBuffer[];

double DnBuffer[];

//+------------------------------------------------------------------+

int init()

{

IndicatorBuffers(5);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexBuffer(0,UpBuffer);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexBuffer(1,DnBuffer);

SetIndexBuffer(2,SumVQ);

SetIndexBuffer(3,VQ);

SetIndexBuffer(4,DIR)。

如果(Length < 2)Length = 2。

如果(Method < 0) Method = 0;

如果(Method > 3) Method = 3;

如果(Smoothing < 0) Smoothing = 0。

如果(Filter < 0)Filter = 0。

string short_name = "VQ | "+ Length + " , " + Method + " , " + Smoothing = 0

方法 + ", " + 平滑 + ", " + 过滤器 + "| "。

IndicatorShortName(short_name)。

SetIndexEmptyValue(0, 0.0)。

SetIndexEmptyValue(1, 0.0);

SetIndexEmptyValue(2, 0.0);

SetIndexEmptyValue(3, 0.0)。

返回(0)。

}

//+------------------------------------------------------------------+

int start()

{

int i, limit, counted_bars=IndicatorCounted()。

//----,检查可能的错误

if(counted_bars<0) return(-1);

//---- 最后一个被计数的柱子将被重新计数。

如果(counted_bars>0) counted_bars--。

//----

如果(counted_bars<1) i=Bars-Length;

否则i=Bars-counted_bars。

如果(counted_bars<1)

while (i >= 0)

{

VQ = iCustom(NULL,0, "#pollan indy",0,i+1)。

SumVQ= iCustom(NULL,0, "#pollan indy",1,i+1);

//if (Filter > 0)

//if (MathAbs(VQ - SumVQ) < Filter)

//VQ = SumVQ。

i--;

}

如果(counted_bars<1)

limit=Bars-Length-1;

否则limit=Bars-counted_bars。

for (i = limit-1; i >= 0; i--)

{

//如果(VQ > SumVQ) DIR = 1;

如果((VQ+VQ) > (SumVQ+SumVQ))

DIR = 1。

如果((VQ+VQ)<(SumVQ+SumVQ))

DIR = -1。

如果((VQ+VQ) == (SumVQ+SumVQ))

DIR=DIR。

如果(DIR>0)

{

UpBuffer=High。

DnBuffer = Low。

}

否则

如果(DIR < 0)

{

DnBuffer = 高。

UpBuffer = Low。

}

如果((DIR>0)&&(DIR>0))。

{

CheckForAlerts(OP_BUY);//ALERT BUY

}

如果((DIR < 0) && (DIR < 0))

{

CheckForAlerts(OP_SELL);//ALERT SELL

}

}

double vq1=iCustom(NULL,0, "#pollan indy",0,i+1);

double svq1=iCustom(NULL,0, "#pollan indy",1,i+1);

double vq2=iCustom(NULL,0, "#pollan indy",0,i+2);

double svq2=iCustom(NULL,0, "#pollan indy",1,i+2);

double vq3=iCustom(NULL,0, "#pollan indy",0,i+3);

double svq3=iCustom(NULL,0, "#pollan indy",1,i+3);

double dir1=DIR;

double dir2=DIR;

double dir3=DIR。

double vq0= (vq1 + vq2);

double svq0= (svq1 + svq2);

string VQ0_Teks=DoubleToStr(vq0,6);

string VQS0_Teks=DoubleToStr(svq0,6);

string VQ1_Teks=DoubleToStr(vq1,6);

string VQS1_Teks=DoubleToStr(svq1,6);

string VQ2_Teks=DoubleToStr(vq2,6);

string VQS2_Teks=DoubleToStr(svq2,6);

string VQ3_Teks=DoubleToStr(vq3,6);

string VQS3_Teks=DoubleToStr(svq3,6);

string dir1_Teks=DoubleToStr(dir1,6);

string dir2_Teks=DoubleToStr(dir2,6);

string dir3_Teks=DoubleToStr(dir3,6);

字符串h =

"Blue" + " " + VQ0_Teks+ " " + " Red" + " + VQS0_Teks + "n" +

"Blue" + " " + VQ1_Teks+ " " + " Red" + " " + VQS1_Teks + "n" +

"Blue" + " " + VQ2_Teks+ " " + " Red" + " " + VQS2_Teks + " "n" + "

"Blue" + " " + VQ3_Teks+ " " + " Red" + " " + VQS3_Teks + " \n" + " \n" +

"DIR1" + " " + dir1_Teks+ " " + "DIR2" + " " + dir2_Teks + " " +"DIR3" + " " + dir3_Teks。

评论(h)。

return(0);

}

//--------------------------------------------------------------

空白 CheckForAlerts(int type)

{

//ALERTS。

static datetime lastAlertTime=0;

如果(lastAlertTime != iTime(NULL,0,0)) {

如果(type==OP_BUY && lastAlert!=2) { //BUY

doAlerts("Pollan BAR UP "+Symbol()+" (tf: "+Period()+")" ,SoundEur)。

lastAlert=2;

lastAlertTime=iTime(NULL,0,0);

}

如果(type==OP_SELL && lastAlert! =1) { //SELL

doAlerts("Pollan BAR DOWN "+Symbol()+" (tf: "+Period()+")" ,SoundGbp);

lastAlert=1。

lastAlertTime=iTime(NULL,0,0);

}

}//if (lastAlertTime != iTime(NULL,0,0) {

//结束警报器

}

//--------------------------------------------------------------

void doAlerts(string sMsg,string SoundFile) {

如果(PopupAlert) Alert(sMsg);

如果(SoundAlert) PlaySound(SoundFile);

如果(SendPushNotification) SendNotification(sMsg);

}

THANKS........

你把它改成使用 "#pollan indy"

我不知道那个指标是做什么的(如果它像其他的 "pollan "指标一样,那么它就会重绘,这可能会导致你的问题,但现在只是在做猜测游戏)。