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);
 
ThemBonez:
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);

Your post (and answer) were moved here : https://www.mql5.com/en/forum/174385/page326