ChartObjects.DrawText (non static position)

Created at 29 Feb 2016, 20:38
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ER

Ermisl

Joined 05.06.2014

ChartObjects.DrawText (non static position)
29 Feb 2016, 20:38


Spotware, 

Could you please confirm that the following version of ChartObjects.DrawText can be used in Cbots as below?

public void DrawText(string objectName, string text, int index, double yValue, [optional] VerticalAlignment verticalAlignment, [optional] HorizontalAlignment horizontalAlignment, [optional] Colors? color)

I have used it in indicators but cannot use it in cbots.  

However, I have used the static position version with success.

public void DrawText(string objectName, string text, StaticPosition position, [optional] Colors? color)

Any help appreciated.


@Ermisl
Replies

Spotware
04 Mar 2016, 11:07

Dear Trader,

The DrawText method can be used in a cBot. Please have a look at the following code snippet.

        protected override void OnStart()
        {
            var name = "myObject";
            var index = MarketSeries.Low.Count - 1;
            var low = MarketSeries.Low.Last(1);
            var text = low.ToString();
            var xPos = index;
            var yPos = low;
            var vAlign = VerticalAlignment.Bottom;
            var hAlign = HorizontalAlignment.Right;
            ChartObjects.DrawText(name, text, xPos, yPos, vAlign, hAlign, Colors.Red);
        }

 


@Spotware

Ermisl
08 Mar 2016, 11:14

thank you for the reply.

 


@Ermisl

gunning.ernie
17 Aug 2018, 22:47

RE:

Spotware said:

Dear Trader,

The DrawText method can be used in a cBot. Please have a look at the following code snippet.

        protected override void OnStart()
        {
            var name = "myObject";
            var index = MarketSeries.Low.Count - 1;
            var low = MarketSeries.Low.Last(1);
            var text = low.ToString();
            var xPos = index;
            var yPos = low;
            var vAlign = VerticalAlignment.Bottom;
            var hAlign = HorizontalAlignment.Right;
            ChartObjects.DrawText(name, text, xPos, yPos, vAlign, hAlign, Colors.Red);
        }

 

Hi Spotware,

 

How would i go about to draw text vertically? like from down to up or up to down?


@gunning.ernie

PanagiotisCharalampous
20 Aug 2018, 10:00

Hi gunning.ernie,

There is no such option currently.

Best Regards,

Panagiotis


@PanagiotisCharalampous