Hello There ! Have some problem with creating my Honrizontal line

Created at 24 Nov 2020, 07:10
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!
IM

imrealfighter

Joined 09.11.2020

Hello There ! Have some problem with creating my Honrizontal line
24 Nov 2020, 07:10


Now I'm trying to create my own Horizontal line but when it runs on cBot my Line it doesn't show up could someone help me please? 

Thank you.

 

 


@imrealfighter
Replies

PanagiotisCharalampous
24 Nov 2020, 08:37

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

imrealfighter
24 Nov 2020, 08:41

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you PanagiotisCharalampous I appreciate it. ! 

but if We use Chart.DrawHorizontalLine() method how are we gonna set isLocked(), isHidden() and IsInteractive() then ? 

 


@imrealfighter

imrealfighter
24 Nov 2020, 08:46

RE: RE:

imrealfighter said:

PanagiotisCharalampous said:

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you PanagiotisCharalampous I appreciate it. ! 

but if We use Chart.DrawHorizontalLine() method how are we gonna set isLocked(), isHidden() and IsInteractive() then ?  (already fixed)

 

 

Edit. I've tried to created Honrizontal line by Chart.DrawHorizontalLine() already and it can set isLocked() and the orthers just by Object.(method) 

so Thank you. :) 
 

 


@imrealfighter

imrealfighter
24 Nov 2020, 14:17

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram

Hello There Again PanagiotisCharalampous
I have some problem with a horizontal line (again) hope you could suggest to me.

Why Chart.DrawHorizontalLine() can use only in protected override void OnStop(){} protected override void OnTick() and protected override void OnStart()

I want to use it in another class how could I do it so? 

Thank you.

 


@imrealfighter

imrealfighter
24 Nov 2020, 14:27

RE: RE:

imrealfighter said:

PanagiotisCharalampous said:

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram

Hello There Again PanagiotisCharalampous
I have some problem with a horizontal line (again) hope you could suggest to me.

Why Chart.DrawHorizontalLine() can use only in protected override void OnStop(){} protected override void OnTick() and protected override void OnStart()

I want to use it in another class how could I do it so? 
 

Edit. Now I know that IF I want to use Chart.DrawHorizontalLine() on another class all I need is declare inherited class from robot class that all. 


and btw the reason that I won't delete my comment because for the sake of our community so maybe someone face the task in the same way like me so that's it. 
Thank you PanagiotisCharalampous  and all of helpers. 

 


@imrealfighter

imrealfighter
24 Nov 2020, 14:58

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

To add a horizontal line to the chart, you need to use Chart.DrawHorizontalLine() method.

Best Regards,

Panagiotis 

Join us on Telegram

Hello There ! (Again) LOOL 

Hope you could help me on this 

Of course that when I create new class that inherited from robot class I could use Chart.DrawHorizontalLine() and no error on this 

my code can build successfully but when I use my method In my class to draw a HorizontalLine my cbot Crashed and it said that 

" Crashed in Onstart with NullReferenceException: Object reference not set to an instance of an object.

What should I do then ? 

Thank you.


@imrealfighter

PanagiotisCharalampous
24 Nov 2020, 16:35

Hi imrealfighter,

The most appropriate way to use the method in another class is to pass the Robot object as an argument. Inheriting it will not work because the new class will not have a char object initialized if it is not added on a chart.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

imrealfighter
25 Nov 2020, 03:09

RE:

PanagiotisCharalampous said:

Hi imrealfighter,

The most appropriate way to use the method in another class is to pass the Robot object as an argument. Inheriting it will not work because the new class will not have a char object initialized if it is not added on a chart.

Best Regards,

Panagiotis 

Join us on Telegram

Hello There PanagiotisCharalampous I've tried to put robot object as a parameter to the class that I want to use and it works. 

Thank you.


@imrealfighter