编码帮助 - 页 489

 

内马尔,我现在明白了,我必须删除 这一行,否则AlarmTotal = AlarmTotal+1。

 

需要帮助在我的指标上添加文本

我写了一个自定义指标,用来寻找波动的高点和低点。

目前,它把一个箭头对象 指向价格水平和时间条。 绿色代表高点,红色代表低点。

我想把它改成显示计数变量的文本。

这是我创建的代码的一部分,但它没有显示文本。

谁能告诉我哪里出了问题。 谢谢。

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);
 
ThemBonez:
我写了一个自定义指标,可以找到波动的高点和低点。

目前,它把一个箭头对象指向价格水平和时间条。 绿色代表高位,红色代表低位。

我想把它改成显示计数变量的文本。

这是我创建的代码的一部分,但它没有显示文本。

谁能告诉我哪里出了问题。 谢谢。

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME,i);

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

尝试改变

ObjectSet("Text",OBJPROP_TIME,i)。

ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips)。

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point)。

 

谢谢你,但没有帮助。 没有文本标签。

下面是整个代码,也许会有帮助。

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

 
ThemBonez:
谢谢你,但没有帮助。 没有文本标签。

这里是整个代码,也许会有帮助。

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingHi+20*pips);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text",OBJ_TEXT,0,0,0);

ObjectSet("Text",OBJPROP_TIME1,Time);

ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text",OBJPROP_TEXT,SwingCount);

ObjectSet("Text",OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

它在那里,但只有一个(回到过去)。

使用这个:

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

//| SwingHighLow.mq4 |

//| Dream Reality Productions, LLC |

//| http://www.dreamrealityproductions.com |

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

#property copyright "Dream Reality Productions, LLC"

#property link "http://www.dreamrealityproductions.com"

#property indicator_chart_window

#property indicator_buffers 6

#property indicator_color1 Orange

#property indicator_color2 Aqua

double SwingHiBar[];

double SwingLoBar[];

double SwingHiDraw[];

double SwingLoDraw[];

double SwingHi[];

double SwingLo[];

static int SwingCount=0;

double pips;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);

SetIndexArrow(1,233);

SetIndexArrow(0,234);

SetIndexBuffer(0,SwingHiDraw);

SetIndexBuffer(1,SwingLoDraw);

SetIndexBuffer(2,SwingHiBar);

SetIndexBuffer(3,SwingLoBar);

SetIndexBuffer(4,SwingHi);

SetIndexBuffer(5,SwingLo);

double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);

if (ticksize == .00001 || ticksize == .001)

pips = ticksize * 10;

else pips = ticksize;

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

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

//| Find Hi and Lo Bars |

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

int counted_bars = IndicatorCounted();

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

if (counted_bars>0) counted_bars--;

int uncountedbars = Bars - counted_bars;

//---

for (int i=4;i<uncountedbars;i++)

{

if (High > High

&& High > High

&& High > High

&& High > High

&& High > High

&& High > High)

{

SwingHiBar = 1;

SwingHi = High;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingHi+20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrGreen);

}

else

{ SwingHiBar=0; SwingHi=0;

SwingHiDraw=0;

if (Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low

&& Low < Low)

{

SwingLoBar = 1;

SwingLo = Low;

SwingCount = SwingCount + 1;

ObjectCreate("Text"+Time,OBJ_TEXT,0,0,0);

ObjectSet("Text"+Time,OBJPROP_TIME1,Time);

ObjectSet("Text"+Time,OBJPROP_PRICE1,SwingLo-20*_Point);

ObjectSetString(0,"Text"+Time,OBJPROP_TEXT,SwingCount);

ObjectSet("Text"+Time,OBJPROP_COLOR,clrRed);

}

else {SwingLoBar = 0; SwingLo=0;

SwingLoDraw=0;}

}

}

return(0);

}

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

亲爱的mladen,mrtools急切地等待你对我在上述帖子中关于改变指标设置的询问的答复。

希望你能在时间允许的情况下给予答复。

谢谢。

 
brijeshsinh:
你好。

mladen, mrtools能不能帮我为指标添加以下设置---Rsi bar chart v2.02 mtf & alerts

--当条形图高于或低于中线(Rsi视角下的50水平)时,能否使用不同的颜色;--即50线以上使用一种颜色,50线以下使用另一种颜色。

在此附上指标和图片。

rsi_bar_chart_v2.02_mtf_amp_alerts.mq4

提前感谢你,你的帮助将是非常感激的。

该指标有4个值(它是由4个不同的rsi值组合而成)。这就排除了穿越--因为没有一个值可以作为穿越某个值的标准。

至于平均数--与交叉点的情况相同:因为有4个rsi值,所以平均数没有一个唯一的值可以应用。

 

谢谢Mladen的回答和为我找时间,我感谢你的帮助。

 

你好。

mladen,工具先生,请你帮助改变以下FXUltraTrend指标的设置,即

----,如果可能的话,为不同的设置增加一栏,这样就可以根据我们的愿望来改变。(在目前的默认模式下,它没有任何栏目可以添加设置)

为您附上以下指标及其图片

fxultratrend.mq4

希望你们不要介意我占用你们的时间,但对于像我们这样刚接触这个平台且不懂编程的人来说,你们的工作非常出色。

你真的值得我和这个论坛的所有成员赞赏你的宝贵努力。

谢谢你对上一篇文章的快速回复。

附加的文件:
444.png  56 kb
 

实施; NonLag_Schaff_TrendCycle指标。

嗨,专业编码人员。

我想知道谁能帮助我实现NonLag_Schaff_TrendCycle指标。

指标外设。

extern int FastLength = 23;

外置 int SlowLength = 50;

extern int StcPeriod = 10;

Extern int MacdPrice = PRICE_CLOSE;

外部 bool Interpolate = true;

外部 bool MultiColor = true。

指标缓冲区。

IndicatorBuffers(8);

SetIndexBuffer(0,stcBuffer);

SetIndexBuffer(1,stcBufferUA);

SetIndexBuffer(2,stcBufferUB)。

SetIndexBuffer(3,macdBuffer);

SetIndexBuffer(4,fastKBuffer);

SetIndexBuffer(5,fastDBuffer);

SetIndexBuffer(6,fastKKBuffer);

SetIndexBuffer(7,trend)。

我尝试做一些事情,比如

double STC1_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar)。

double STC2_c=iCustom(Symbol(),0, "NonLag_Schaff_TrendCycle",FastLength,SlowLength,StcPeriod,MacdPrice,Interpolate,0,bar+1);

如果((STC1_c>15 && STC2_c85 && STC2_c BUY)

如果((STC1_c15)||(STC1_c85)->卖出

但我得到一个错误信息。

错误。NonLag_Schaff_TrendCycle已被删除。

我想我可能读错了缓冲区。有谁有建议吗?

提前感谢您!