Help with code

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

Help with code

Postby aczk » 24 Oct 2014

Hi All

Made this indie that plots simple stats on the chart qwith the text_float function.

but I freqeuntly get the "Text ID not found Error", any help appreciated. Code below:

Code: Select all

Inputs: BarSizeColour (Darkgray),FloatH (0),FloatV (10), Decimals(0),
TxtSzr(8),emalength(20),spacer(4) ;
var : BarsizeVar(0), RangeVar(0),XMADistVar(0),SpreadVar(0);
// 1 BarSize ////////////////////////////////////////////////////////////////////////////////////////////////////
Once Begin
BarsizeVar = Text_New(0, 0, 0, " ");
end;

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

// 2 Range /////////////////////////////////////////////////////////////////////////////////////////////////////
Once Begin
RangeVar= Text_New(0, 0, 0, " ");
end;

If LastBarOnChart then begin
value5 = Text_SetString(RangeVar, "Range " + NumToStr(DailyRange(1),Decimals) + " / " + NumToStr(DailyRange(0),Decimals));
value6 = Text_SetColor(RangeVar, BarSizeColour);
value7 = text_setsize(RangeVar, TxtSzr);
value8 = Text_Float(RangeVar, FloatH, FloatV+spacer);
End;

// 3 EMA Distance///////////////////////////////////////////////////////////////////////////////////////////////
Once Begin
XMADistVar= Text_New(0, 0, 0, " ");
end;
vars: XMAdist(0);
XMAdist = c-(XAverage(c,emalength));
If LastBarOnChart then begin
value9 = Text_SetString(XMADistVar, "XMADist " + NumToStr(XMAdist,Decimals) );
value10 = Text_SetColor(XMADistVar, BarSizeColour);
value11 = text_setsize(XMADistVar, TxtSzr);
value12 = Text_Float(XMADistVar, FloatH, FloatV-spacer);
End;

thx

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Help with code bug

Postby JoshM » 25 Oct 2014

I've tested this indicator on a 15minute EUR/AUD chart with Playback (since it's weekend) and the error does not happen on my end.

Since the error message is generated by the Text_Float function, have you considered not using this function but the PowerLanguage keywords Text_SetLocation() and Text_SetStyle() instead?


Return to “MultiCharts”