TextID does not exist

Questions about MultiCharts and user contributed studies.
aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

TextID does not exist

Postby aczk » 22 Jul 2014

Hi All
Made an indicator to plot the range, barsize and distance from the XMA in text on the chart.

It works just every now and then (seems when the XMA in part 3 of the code is crossed) the indicator give me an error: "TextID does not exist."

Code:

Code: Select all

Inputs: BarSizeColour (Darkgray),FloatH (0),FloatV (10), Decimals(0),TxtSzr(8);

// 1 BarSize ////////////////////////////////////////////////////////////////////////////////////////////////////
If BarNumber = 1 then begin
Value1 = Text_New(0, 0, 0, " ");
end;

If LastBarOnChart then begin
Value2 = Text_SetString(Value1, "BarSize " + NumToStr((High[1]-Low[1]),Decimals) + " / " + NumToStr((High-Low),Decimals));
Value2 = Text_SetColor(Value1, BarSizeColour);
Value2 = Text_Setsize(Value1, TxtSzr);
Value2 = Text_Float(Value1, FloatH, FloatV);
End;

// 2 Range /////////////////////////////////////////////////////////////////////////////////////////////////////
If BarNumber = 1 then begin
Value3 = Text_New(0, 0, 0, " ");
end;

If LastBarOnChart then begin
value4 = Text_SetString(Value3 , "Range " + NumToStr(DailyRange(1),Decimals) + " / " + NumToStr(DailyRange(0),Decimals));
value4 = Text_SetColor(Value3 , BarSizeColour);
value4 = text_setsize(Value3 , TxtSzr);
value4 = Text_Float(Value3, FloatH, FloatV+5);
End;

// 3 EMA Distance///////////////////////////////////////////////////////////////////////////////////////////////
If BarNumber = 1 then begin
value5 = Text_New(0, 0, 0, " ");
end;
vars: XMAdist(0);
XMAdist = c-(XAverage(c,20));
If LastBarOnChart then begin
value6 = Text_SetString(value5 , "XMADist " + NumToStr(XMAdist,Decimals) );
value6 = Text_SetColor(value5 , BarSizeColour);
value6 = text_setsize(value5 , TxtSzr);
value6 = Text_Float(value5 , FloatH, FloatV-5);
End;
Appreciate any feedback on this,

Thanks.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: TextID does not exist

Postby furytrader » 22 Jul 2014

What is the function "DailyRange?" Is that a custom function? I'm running v8.8 and I don't have that on my system.

To test your indicator, I changed DailyRange to Range. I then ran this indicator on a 1 second YM chart, during which time the price traded above and below the XMA, and I didn't receive any error.

Does the error always happen when price crosses the XMA, or just some of the time? Also, if DailyRange is a custom function, could that be the source of the trouble?

aczk
Posts: 71
Joined: 08 Feb 2012
Has thanked: 8 times
Been thanked: 1 time

Re: TextID does not exist

Postby aczk » 22 Jul 2014

the dailyrange function is simply:

Code: Select all

inputs: DaysAgo(numeric);


DailyRange = Highd(DaysAgo) - Lowd(DaysAgo) ;

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: TextID does not exist

Postby furytrader » 22 Jul 2014

Does the error always happen when price crosses the XMA, or just some of the time?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: TextID does not exist

Postby TJ » 22 Jul 2014

try the following:

1. refrain from using generic variable names. ie. value1, value2, etc.,
Variable names are free; a meaningful name can save you time and effort in debugging.

2. change the following:

from

Code: Select all

If BarNumber = 1 then begin
to

Code: Select all

Once Begin


Return to “MultiCharts”