编码帮助 - 页 111

 

非常感谢!你是如此的好!你是如此的好!"。

 

你好。

有谁知道有什么指标可以像下面描述的那样在图表上只画出摆动点(就像Pipware Dashboard里的那个)。

分形突破策略

如前所述,价格行动是以波浪形式进行的。趋势方向(上升或下降)是由连续的高点和低点决定的。

上升趋势是指这些波浪创造更高的高点和更高的低点。

下跌趋势是指这些波浪的低点和高点较低。

因为分形是高点和低点,它们可以用来确定趋势方向。

考虑一下GU的H4图表(右图)。在A点之前,趋势是向上的,即第二个低点分形比第一个分形高,第二个高点分形比第一个分形高。

一个新的低点分形在A点形成,并且高于前两个低点分形(继续上升趋势)。紧接着A点的蜡烛形成了一个新的高分形。这个分形比它之前的高分形要低,表明 趋势方向可能发生变化。B点下的蜡烛 "打破 "了A点的分形水平(绿线)。一个红色的箭头被画出来,表明趋势方向已经改变为下跌。

箭头可以通过ArrowsOn=true来显示。注意:只有当分形突破改变趋势方向时才会画出箭头。例如,在B点之后,较低的分形继续被打破(还有2次)。

在B点之后,趋势被认为是下跌的,直到一个高分形被打破。就在C点之前,一个较高的低分形形成。趋势方向仍然被认为是向下的......还没有高分形被打破。

在E点,C点的高分形被打破。尽管这是一个小的突破,但在D点画出了一个绿色的箭头,表明趋势方向的改变。现在的趋势被认为是上升的,直到下一个低分形的突破。

非常感谢您的帮助。

最好的。

格林戈尔

附加的文件:
 

谢谢你,Mladen,这很完美!!!如果我想在指标上再加一行,如何修改代码? 如果我想在这个指标上再加一行,我该如何修改代码?提前感谢....

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

double UpperBuf[];

double UpperBuf1[];

double UpperBufb[];

double UpperBuf1b[];

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

//| |

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

void init()

{

IndicatorBuffers(4);

SetIndexBuffer(0, UpperBuf1);

SetIndexBuffer(1, UpperBuf1b);

SetIndexBuffer(2, UpperBuf);

SetIndexBuffer(3, UpperBufb);

}

void deinit() {}

void start()

{

int counted = IndicatorCounted();

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

if(counted > 0) counted--;

int limit = Bars - counted;

for(int i = 0; i < limit; i++)

if (Close!=0)

UpperBuf= ((High/Close)-34)*Volume;

else UpperBuf= 0;

for( i = 0; i < limit; i++) UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

for( i = 0; i < limit; i++)

if (Close!=0)

UpperBufb= ((High/Close)-34)*Volume;

else UpperBufb= 0;

for( i = 0; i < limit; i++) UpperBuf1b= iMAOnArray(UpperBufb,0,33,0,MODE_EMA,i);

}

 
k3rn3l:
谢谢你,Mladen,这很完美!!!如果我想在指标上再加一条线,那就得把这条线加到指标上。 如果我想像这样在指标上再加一行,如何修改代码?提前感谢....

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

double UpperBuf[];

double UpperBuf1[];

double UpperBufb[];

double UpperBuf1b[];

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

//| |

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

void init()

{

IndicatorBuffers(4);

SetIndexBuffer(0, UpperBuf1);

SetIndexBuffer(1, UpperBuf1b);

SetIndexBuffer(2, UpperBuf);

SetIndexBuffer(3, UpperBufb);

}

void deinit() {}

void start()

{

int counted = IndicatorCounted();

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

if(counted > 0) counted--;

int limit = Bars - counted;

for(int i = 0; i < limit; i++)

if (Close!=0)

UpperBuf= ((High/Close)-34)*Volume;

else UpperBuf= 0;

for( i = 0; i < limit; i++) UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

for( i = 0; i < limit; i++)

if (Close!=0)

UpperBufb= ((High/Close)-34)*Volume;

else UpperBufb= 0;

for( i = 0; i < limit; i++) UpperBuf1b= iMAOnArray(UpperBufb,0,33,0,MODE_EMA,i);

}

k3rn3l

你已经做了(指标上有两行)。如果你想再加一条(有3条),只需按你对第二条线所做的同样的事情做即可

 

亲爱的编码员。

我发现这个METASTOCK指标非常好,你能不能把它做成MT4的?

x:=Input("Consecutive Lower Closes - Entry",

0,21,5);

y:=输入("连续较高收盘价-退出",

0,21,5);

delay:=Input("进入和退出延迟",0,5,0)。

plot:=Input("信号。 [1]清洁,[2]所有"。

1,2,2);

In:=Sum(C<Ref(C,-1),x)=x;

Out:=Sum(C>Ref(C,-1),y)=y。

Init:=Cum(In+Out>-1)=1。

InInit:=Cum(In)=1;

flag:=BarsSince(Init OR In)

<BarsSince(Init OR Out)+InInit;

信号:=(InInit AND Alert(InInit=0,2)

OR flag AND Alert(flag=0,2))

-(flag=0 AND Alert(flag,2))。

0;Ref(If(plot=1,signals,In-Out),-delay)

 
debashis:
亲爱的编码员。

我发现这个METASTOCK指标非常好,你能把它做成MT4的吗?

x:=Input("Consecutive Lower Closes - Entry",

0,21,5);

y:=输入("连续较高收盘价-退出",

0,21,5);

delay:=Input("进入和退出延迟",0,5,0)。

plot:=Input("信号。 [1]清洁,[2]所有"。

1,2,2);

In:=Sum(C<Ref(C,-1),x)=x;

Out:=Sum(C>Ref(C,-1),y)=y。

Init:=Cum(In+Out>-1)=1。

InInit:=Cum(In)=1;

flag:=BarsSince(Init OR In)

<BarsSince(Init OR Out)+InInit;

信号:=(InInit AND Alert(InInit=0,2)

OR flag AND Alert(flag=0,2))

-(flag=0 AND Alert(flag,2))。

0;Ref(If(plot=1,signals,In-Out),-delay)

debashis

该指标的名称是什么?

 

大师

它被称为 "基本模式系统"。http://www.metastocktools.com/MetaStock/Pattern01.txt

 

嗨,Malden,感谢你在ASCTrend方面对我的帮助。我想知道你是否能帮我为这个指标做一个EA。还有一个指标叫MaonMa。(我的想法是,当ASCTrend箭头向上,并且条形图在黄线(60MA)之上时,做多交易,止损将是之前的最低值,同样地,当ASCTrend箭头向下,并且条形图在黄线(60MA)之下时,做空交易,止损将是之前的最高值。谢谢。

附加的文件:
 

你好,Mladen。

我再次需要你的帮助。我为基于箭头的指标设置了以下代码,但它冻结了电脑。如果它能防止滞后,你能否用指标中的原始rsi,cci和cmo代码再次编写代码,而不用icustom函数。

#property indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 Crimson

#属性 indicator_color2 RoyalBlue

//---- 输入参数

extern int barsToProcess=100;

//---- 缓冲区

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//|自定义指标 初始化函数|

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

int init()

{

//---- 指标

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,233);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW)。

SetIndexArrow(1,234)。

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0)。

//----

返回(0)。

}

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

//|自定义指标去初始化功能|

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

int deinit()

{

//----

//----

return(0);

}

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

//|自定义指标迭代函数|

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

int start()

{

int counted_bars=IndicatorCounted(),

限度。

如果(counted_bars>0)

counted_bars--。

limit=Bars-counted_bars。

如果(limit>barsToProcess)

limit=barsToProcess。

for(int i=0;i<limit;i++)

{

double rsi=iCustom(NULL,0, "rsi",barsToProcess,0,i)。

double cci=iCustom(NULL,0, "cci",barToProcess,0,i);

double cmo=iCustom(NULL,0, "cmo", barsToProcess,0,i);

如果(rsi>60.0&& cci>150.0&& cmo>30.0)

ExtMapBuffer1=High+5*Point;

否则

ExtMapBuffer1=0.0。

如果(rsi<10.0&& cci<-150.0&& cmo<-30.0)

ExtMapBuffer2=Low-5*Point。

否则

ExtMapBuffer2=0.0。

}

return(0);

}

 
anonimm:
你好,Mladen。

我再次需要你的帮助。我为一个基于箭头的指标设置了以下代码,但它冻结了电脑。如果它能防止滞后,你能用指标中的原始rsi、cci和cmo代码再写一遍代码,而不使用icustom函数。

#property indicator_chart_window

#属性 indicator_buffers 2

#属性 indicator_color1 Crimson

#属性 indicator_color2 RoyalBlue

//---- 输入参数

extern int barsToProcess=100;

//---- 缓冲区

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//|自定义指标初始化函数|

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

int init()

{

//---- 指标

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,233);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexEmptyValue(0,0.0);

SetIndexStyle(1,DRAW_ARROW)。

SetIndexArrow(1,234);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexEmptyValue(1,0.0)。

//----

返回(0)。

}

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

//|自定义指标去初始化功能|

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

int deinit()

{

//----

//----

return(0);

}

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

//|自定义指标迭代函数|

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

int start()

{

int counted_bars=IndicatorCounted(),

限度。

如果(counted_bars>0)

counted_bars--。

limit=Bars-counted_bars。

如果(limit>barsToProcess)

limit=barsToProcess。

for(int i=0;i<limit;i++)

{

double rsi=iCustom(NULL,0, "rsi",barsToProcess,0,i)。

double cci=iCustom(NULL,0, "cci",barToProcess,0,i);

double cmo=iCustom(NULL,0, "cmo", barsToProcess,0,i);

如果(rsi>60.0&& cci>150.0&& cmo>30.0)

ExtMapBuffer1=High+5*Point;

否则

ExtMapBuffer1=0.0。

如果(rsi<10.0&& cci<-150.0&& cmo<-30.0)

ExtMapBuffer2=Low-5*Point。

否则

ExtMapBuffer2=0.0。

}

return(0)。

}

使用iCustom()来代替rsi和cci,使用内置的函数

RSI需要的参数:

shift)[/TD] [/ iCCI([TD]string symbol,int timeframe,int period, int applied_price,int shift)
double iRSI([/TD]string symbol,int timeframe,int period,int applied_price,int

TABLE]

[

/

TABLE]

CCI需要的参数:

[TABLE="class: docvar"]

[TR]

[TD]double

而对于CMO,第一个参数是LastBarOnly,第二个参数是CMO_Range,所以iCustom()的调用应该是这样的。

iCustom(NULL,0, "cmo",false,CMORange,0,i)。

其中CMORange将是一些参数