ITextObject at fixed position

Questions about MultiCharts .NET and user contributed studies.
mirek
Posts: 24
Joined: 08 Jan 2013
Has thanked: 3 times
Been thanked: 3 times

ITextObject at fixed position

Postby mirek » 05 Nov 2013

Hi all,

I would like to use ITextObject in the different subchart than the instrument. I would like to have more text values displayed for each bar in the new subchart. Can you point me to example?

It works at the same chart like the instrument, but the position below lowValue is not the best one.

Thank you

mirek

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ITextObject at fixed position

Postby Henry MultiСharts » 06 Nov 2013

Hello mirek,

Please find a sample code attached.
Attachments
Test_TextDraving.pln
(1.14 KiB) Downloaded 546 times

mirek
Posts: 24
Joined: 08 Jan 2013
Has thanked: 3 times
Been thanked: 3 times

Re: ITextObject at fixed position

Postby mirek » 06 Nov 2013

Hi Henry,

thx for reply, but I need to do something else. I would like to display 4-5 text items per 1 bar in a separate chart window. Like this:
Price
bar4_item1 bar3_item1 bar2_item1 bar1_item1 50
bar4_item2 bar3_item2 bar2_item2 bar1_item2 40
bar4_item3 bar3_item3 bar2_item3 bar1_item3 30
bar4_item4 bar3_item4 bar2_item4 bar1_item4 20
bar4_item5 bar3_item5 bar2_item5 bar1_item5 10

I would like to be independent on the price of instrument.

Thank you
mirek

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ITextObject at fixed position

Postby Henry MultiСharts » 06 Nov 2013

mirek, what is the particular difficulty you have?

mirek
Posts: 24
Joined: 08 Jan 2013
Has thanked: 3 times
Been thanked: 3 times

Re: ITextObject at fixed position

Postby mirek » 06 Nov 2013

Hi Henry,

I have figured it out. I was not able to see anything on the new chart without instrument.The following code did it(AddMinutes(0) could be omitted):

Code: Select all

ChartPoint b1 = new ChartPoint(Bars.TimeValue.AddMinutes(0), -0.5);

if (vp != null)
{

ITextObject textTotal_Volume = DrwText.Create(b1, vp.TotalValue.ToString(), true);
textTotal_Volume.VStyle = ETextStyleV.Below;
}
It is a little bit tricky that you have to play around 0 price, which is in the middle of the new chart window. Anyway it works.

One more question. I would like to put a legend in front of data. I mean 1st bar from left will have no numbers but fixed text which explains rows. Would you tell me how to achieve it?

Is there away how to find most left bar in the current chart?
Isthere away how to find the lowest price on the actual chart?

It would give me a possibility to integrate it inside Instrument chart.

Thank you

mirek

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: ITextObject at fixed position

Postby MidKnight » 06 Nov 2013

It sounds like what you want is screen locations and not chart points, right?

If so, I had queried about this before and Henry pointed me to the Environment class. As an example:

Code: Select all

label.Location = new ChartPoint(Environment.RightScreenTime, Environment.HighestScaleValue);
Maybe you find all you need in this thread:

Code: Select all

http://www.multicharts.com/discussion/viewtopic.php?f=19&t=45230
With kind regards,
MK

mirek
Posts: 24
Joined: 08 Jan 2013
Has thanked: 3 times
Been thanked: 3 times

Re: ITextObject at fixed position

Postby mirek » 08 Nov 2013

Hi MidKnight,

thx for reply. I have read your thread, but I need only text below bars. I do not need to place it anywhere on the screen. I wonder about that possibility in the next version of indicator, when I do not want to display it on separate chart, but on the same chart like the instrument.

I was able to manage it by AddMinute, but I am not able to do it only one time. I have tried to do it in

Code: Select all

protected override void StartCalc() {
// assign inputs
}
but it does not work(the text on the left was not displayed). Does it mean that following text placement:

Code: Select all

ChartPoint b_1 = new ChartPoint(Bars.TimeValue.AddMinutes(4), -0.5);
ITextObject text_Total_Volume = DrwText.Create(b_1, "Total Volume", true);
text_Total_Volume.VStyle = ETextStyleV.Below;
could be done only in :

Code: Select all

protected override void CalcBar(){
// indicator logic
}
Do I miss something?

If it is done in the indicator logic it is shifting to left by each bar. See attached pictures.It will cause that I have totally unreadable mess of characters after a while:-)

Thank you a lot for a help.

mirek
Attachments
bad_ex.PNG
(14.18 KiB) Downloaded 702 times


Return to “MultiCharts .NET”