How to Reference a non interactive Trend Line object
How to Reference a non interactive Trend Line object
06 Dec 2023, 22:33
Hi guys,
I'm trying to reference my non interactive trend lines within my cBot, i.e. those lines that 1.) disappear when the robot is closed, and 2.) have the ChartTrendLine attribute isInteractive set to false.
For example, I have 6 interactive trend lines on my chart, and 20+ non interactive trend lines on the chart at the same time.
Using the following code:
Print("1 ", + Chart.FindAllObjects<ChartTrendLine>().Count());
Print("2 ", + Chart.FindAllObjects<ChartTrendLine>().Where(i => i.IsInteractive == false).Count());
Print("3 ", + Chart.FindAllObjects(ChartObjectType.TrendLine).Count());
I receive the following output:
1 - 6
2 - 0
3 - 6
As you can see, the non interactive chart lines aren't counted.
Is there something else i should be looking for instead? I assumed that Chart.FindAllObjects would also include those that are visible on the chart, even if they aren't interactable. Is there another query i should be using?
Thanks in advance,
Replies
Giorgi_1
07 Dec 2023, 08:43
RE: How to Reference a non interactive Trend Line object
PanagiotisCharalampous said:
Hi there,
Can you please share the complete cBot code? Are these lines drawn by the same cBot?
Best regards,
Panagiotis
Hi Panagiotis!
The lines were being drawn on cBot A, and the Print out on cBot B. I've now combined them, and they're working as expected.
So, essentially there is no issue. However, can you confirm that a non interactive Chart object can only be referenced by it's own cBot? And is that how it's meant to execute? In my mind, Chart.FindAllObjects would find all objects on the chart, regardless of their origin, perhaps my understanding is wrong?
Many Thanks,
@Giorgi_1
PanagiotisCharalampous
07 Dec 2023, 13:08
RE: RE: How to Reference a non interactive Trend Line object
Giorgi_1 said:
PanagiotisCharalampous said:
Hi there,
Can you please share the complete cBot code? Are these lines drawn by the same cBot?
Best regards,
Panagiotis
Hi Panagiotis!
The lines were being drawn on cBot A, and the Print out on cBot B. I've now combined them, and they're working as expected.
So, essentially there is no issue. However, can you confirm that a non interactive Chart object can only be referenced by it's own cBot? And is that how it's meant to execute? In my mind, Chart.FindAllObjects would find all objects on the chart, regardless of their origin, perhaps my understanding is wrong?
Many Thanks,
Hi Giorgi,
That is correct. Non interactive objects are only accessible by the algo that created them.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Dec 2023, 06:37
Hi there,
Can you please share the complete cBot code? Are these lines drawn by the same cBot?
Best regards,
Panagiotis
@PanagiotisCharalampous