Draw ahead of current index

Created at 04 Jul 2022, 14:01
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!
WA

waym77

Joined 22.07.2021

Draw ahead of current index
04 Jul 2022, 14:01


Hi,

 

I would like an indicator to draw text values ahead of index time, e.g. this rectangle:

Please advise API guide for this?

Thanks.


@waym77
Replies

PanagiotisCharalampous
05 Jul 2022, 12:21

Hi waym77,

There is nothing special about this. You just need to use the starting and ending time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

waym77
05 Jul 2022, 14:25

RE:

PanagiotisCharalampous said:

Hi waym77,

There is nothing special about this. You just need to use the starting and ending time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi Panagiotis, 

 

Thanks for the reply.

 

That I do understand, regarding X being related to OpenTimes.Last. My confusion is more in the sense of how to draw ahead of LastValue?

For instance:

Chart.DrawText("Object", "Sample", Bars.OpenTimes.Last(?), Bars.HighPrices.LastValue, Color.White);

The (?) is where my confusion is.

 

Thanks,


@waym77

PanagiotisCharalampous
05 Jul 2022, 18:14

Hi waym77,

You can't use Bars.OpenTimes because it does not contain the time you want. You need to set the actual time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

waym77
06 Jul 2022, 08:56

RE:

PanagiotisCharalampous said:

Hi waym77,

You can't use Bars.OpenTimes because it does not contain the time you want. You need to set the actual time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi, 

Thanks, would you mind providing me with an example related to the DrawText? Wouldn't the time specified be needed to be adjusted for each timeframe?

I'm unfamiliar with DateTime, as I've only ever used Bars.OpenTimes for Chart Objects until now.


@waym77

PanagiotisCharalampous
06 Jul 2022, 14:20

Hi waym77,

Here is an example

 Chart.DrawRectangle("Rectangle", Server.Time.AddHours(1), Symbol.Bid, Server.Time.AddHours(10), Symbol.Bid + (Symbol.PipSize *10),Color.Red);

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous