DrawText on Indicator when IsOverlay = false

Created at 04 Dec 2018, 20:37
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!
bienve.pf's avatar

bienve.pf

Joined 19.09.2018

DrawText on Indicator when IsOverlay = false
04 Dec 2018, 20:37


Hello, is it possible to draw text or lines in an indicator with IsOverlay = false?

AND, It is possible to paint text with different size in Charts?

Thanks!


@bienve.pf
Replies

PanagiotisCharalampous
05 Dec 2018, 12:06

Hi bienve.pf,

"Hello, is it possible to draw text or lines in an indicator with IsOverlay = false?"

Yes this is possible

"AND, It is possible to paint text with different size in Charts?"

It is not possible to set the text size at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
05 Dec 2018, 13:11

In this example it does not work. Do not draw the text in the Indicator ChartArea:

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class overlay : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            Result[index] = 1;
            if( IsLastBar){              
               var txt = Chart.DrawText("txt", "EURUSD", index + 3, 1, Color.Orange);             
            }
        }
    }
}


@bienve.pf

PanagiotisCharalampous
05 Dec 2018, 14:43

Hi bienve.pf,

Use the following line of code

var txt = IndicatorArea.DrawText("txt", "EURUSD1", index + 3, 1, Color.Orange);

Best Regards,

Panagiotis


@PanagiotisCharalampous

bienve.pf
05 Dec 2018, 15:17

Ok. It Work. Thanks.


@bienve.pf

nguyenluat.6996
05 Apr 2020, 14:12

I cannot draw text to chart anymore
var txt = IndicatorArea.DrawText("txt", "EURUSD1", index + 3, 1, Color.Orange);

 

It's not work anymore!


@nguyenluat.6996

PanagiotisCharalampous
06 Apr 2020, 09:07

Hi nguyenluat.6996,

Can you provide us the complete code?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous