Managing text + getting Cumulative Delta value  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
User avatar
Al3cs
Posts: 20
Joined: 22 Jun 2017
Location: Italy
Has thanked: 18 times

Managing text + getting Cumulative Delta value

Postby Al3cs » 11 Sep 2018

Hi all,
I'm slowly learning to write some code.
I have 2 problems

1.
I'm having some issues with text on subchart. I want to show a legend in fixed position so I wrote this piece of code in StartCalc()

Code: Select all

ITextObject textVolLeg = DrwText.Create(new ChartPoint(Bars.LastBarTime, 0), "Volume", true);
but when a new bar is produced my text is been overwritten so I have to specify text's position indipendently from last bar on screen.
How could I solve it?
2018-09-11 15_32_32-.png
2018-09-11 15_32_32-.png (7.22 KiB) Viewed 425 times
2018-09-11 15_45_57-Clipboard.png
2018-09-11 15_45_57-Clipboard.png (6.84 KiB) Viewed 425 times

2.
I can't find the way to get Cumulative Delta value and I don't want (if possible) use 2nd data series only for this purpouse. I would like to fill the first row of the indicator shown above.
For other values I'm using this code, accordingly with TradingCode.net samples (thank you guys for sharing)

Code: Select all

ITextObject textVolume = DrwText.Create(new ChartPoint(Bars.Time[0], 0),"",true);
textVolume.Text = textVolume.Text + Bars.TrueVolume().Value;

User avatar
Al3cs
Posts: 20
Joined: 22 Jun 2017
Location: Italy
Has thanked: 18 times

Re: Managing text + getting Cumulative Delta value

Postby Al3cs » 11 Sep 2018

I have solved point 2 in this way :

Code: Select all


public double CumDelta { get; set; }


if (Bars.Time[0].Date != Bars.Time[1].Date)
{
CumDelta = Delta;
}
else
{
CumDelta += Delta;
}
Help still needed on point 1

User avatar
ABC
Posts: 626
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: Managing text + getting Cumulative Delta value  [SOLVED]

Postby ABC » 11 Sep 2018

Al3cs,

you could update the text location of your text with every new bar.

Regards,

ABC
These users thanked the author ABC for the post:
Al3cs

User avatar
Al3cs
Posts: 20
Joined: 22 Jun 2017
Location: Italy
Has thanked: 18 times

Re: Managing text + getting Cumulative Delta value

Postby Al3cs » 12 Sep 2018

About point 1, here's the solution I found:

I have defined my private ITextObject in main indicator's class
Created my text on StartCalc()
Modified it's position on CalcBar() under the condition

Code: Select all

if (Bars.Time[0] != Bars.Time[1]) //If true we have a new candle
This applies to all legend's text.
Thank you ABC for the hint.

Hope it helps,
regards.


Return to “MultiCharts .NET”