Page 1 of 1

Managing text + getting Cumulative Delta value

Posted: Sep 11 2018
by Al3cs
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
(7.22 KiB) Downloaded 545 times
2018-09-11 15_45_57-Clipboard.png
(6.84 KiB) Downloaded 545 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;

Re: Managing text + getting Cumulative Delta value

Posted: Sep 11 2018
by Al3cs
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

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

Posted: Sep 11 2018
by ABC
Al3cs,

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

Regards,

ABC

Re: Managing text + getting Cumulative Delta value

Posted: Sep 12 2018
by Al3cs
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.