You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Nevermind, i see now that i have to remove the line else AlarmTotal = AlarmTotal+1;
Need Help Adding Text to my Indicator
I wrote a custom indicator that finds the swing highs and lows.
Currently it puts an arrow object point to the price level and the time bar. Green for High and Red for Low.
I would like to change it to text that shows a count variable.
Here is a portion of the code I created but it isnt showing the text.
Can someone show me what is wrong. Thanx.
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);I wrote a custom indicator that finds the swing highs and lows.
Currently it puts an arrow object point to the price level and the time bar. Green for High and Red for Low.
I would like to change it to text that shows a count variable.
Here is a portion of the code I created but it isnt showing the text.
Can someone show me what is wrong. Thanx.
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);Try changing
ObjectSet("Text",OBJPROP_TIME,i);
ObjectSet("Text",OBJPROP_PRICE,SwingLo-20*pips);
to
ObjectSet("Text",OBJPROP_TIME1,Time);
ObjectSet("Text",OBJPROP_PRICE1,SwingLo-20*_Point);
Thank you, but didn't help. No Text Labels.
Here's the entire code, maybe that would help.
//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+
Thank you, but didn't help. No Text Labels.
Here's the entire code, maybe that would help.
//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+
It was there, but just one (back in the past)
Use this :
//| 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);
}
//+------------------------------------------------------------------+dear mladen, mrtools waiting eagerly for your reply for my queries regarding change of settings of indicator in above post.
hope you will give reply when time permits to you.
thanks.
hello,
can mladen, mrtools help me to add following settings for indicator--- Rsi bar chart v2.02 mtf & alerts
--can bars be colored differently when they crosses above or below middle line( 50 level for rsi perspective); --i.e above 50 line one color and below 50 level different color.
---can moving average be added on indicator in seperate window, as we can add moving average for main chart.(as is seen in below image.
attaching here indicator and image.
rsi_bar_chart_v2.02_mtf_amp_alerts.mq4
thanks in advance, your help will be much appreciated.That indicator has 4 values (it is combined from 4 different rsi values). That excludes the crossing - since there is no one value that can be used as a criteria fro crossing some value
As of average - same thing as for the crosses : since there are 4 rsi values average does not have a unique value to be applied to
thanks mladen for reply and finding time for me. i appreciate you for your help.
hello,
mladen, mr tools can you please help change following settings in indicator FXUltraTrend posted below to
--- show in seperate window as line, (or histogram) with arrows to show color change if possible (by default in present setting it paints bars on main chart)
---- and if possible to add column for different settings, so as it can be changed according to our wish. ( in current default mode it does not have any column to add settings)
attaching below indicator and its image for you
fxultratrend.mq4
hope you will not mind me for taking some time of you, but you guys are doing great job for someone like us who are new to this platform and not knowing programming.
you really deserve appreciation from me and from all members on this forum for your valuable efforts.
thanks for quick reply for previous post.
Implement; NonLag_Schaff_TrendCycle indicator:
Hi Pro-Coders,
I wonder someone could help me in implementing the NonLag_Schaff_TrendCycle indicator.
Indicator Externs:
extern int FastLength = 23;
extern int SlowLength = 50;
extern int StcPeriod = 10;
extern int MacdPrice = PRICE_CLOSE;
extern bool Interpolate = true;
extern bool MultiColor = true;
Indicator Buffers:
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);
I try to do something like:
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);
if((STC1_c>15 && STC2_c85 && STC2_c BUY
if((STC1_c15)||(STC1_c85) -> SELL
But I get an error message:
Error: NonLag_Schaff_TrendCycle has been removed.
I guess I may read the buffers wrong. Does anyone have a suggestion?
Thank you in advance!