SignalLineRepository and CalculatingY

Created at 10 Aug 2023, 23:43
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!
GI

Giorgi_1

Joined 23.06.2023

SignalLineRepository and CalculatingY
10 Aug 2023, 23:43


Hi folks, 

I'm looking to loop through the SignalLineRepository and calculateY on each of the stored lines. 

If i were to run a for loop using each as a ChartTrendLine, i.e Chart.FindAllObjects<ChartTrendLine>etc,  i have the CalculateY reference, but i don't if i do it specifically for SignalLineRepositoryLines, despite being trendlines.

 

            foreach(var line in Chart.FindAllObjects<ChartTrendLine>())
                {
                	line.CalculateY(Server.Time); - Works Perfectly
                }
            foreach (var signalLine in SignalLineRepository.GetLines())
                {

                    
		signalLine.CalculateY(Server.Time); - Doesn't Work, Method/Reference doesn't exist.

                }
            

 

Is this possible? And if so, could anyone point me in the right direction?

Thanks,


@Giorgi_1
Replies

PanagiotisChar
11 Aug 2023, 05:19

Hi there,

What is a SignalLineRepository? Where did you find this?

Aieden Technologies

Need help? Join us on Telegram


 


@PanagiotisChar

Giorgi_1
11 Aug 2023, 07:19

RE: SignalLineRepository and CalculatingY

PanagiotisChar said: 

Hi there,

What is a SignalLineRepository? Where did you find this?

Aieden Technologies

Need help? Join us on Telegram


 

Hi @PanagiotisChar!

It is in the Sample Lines Trader code, here:

https://ctrader.com/forum/calgo-reference-samples/13504

It's one of the default scripts when you download cTrader, it's possible i've given the Class name, which is no help whatsoever! Sorry about that!


@Giorgi_1

PanagiotisChar
11 Aug 2023, 08:03

It's because there are two different types of objects. First change

        private readonly ChartTrendLine _chartTrendLine;

In SignalLine class to

        public ChartTrendLine ChartTrendLine;

and then try


           foreach (var signalLine in SignalLineRepository.GetLines())
           {
               signalLine.ChartTrendLine.CalculateY(Server.Time);
           }


@PanagiotisChar

Giorgi_1
11 Aug 2023, 08:30

RE: SignalLineRepository and CalculatingY

PanagiotisChar said: 

It's because there are two different types of objects. First change

        private readonly ChartTrendLine _chartTrendLine;

In SignalLine class to

        public ChartTrendLine ChartTrendLine;

and then try


           foreach (var signalLine in SignalLineRepository.GetLines())
           {
               signalLine.ChartTrendLine.CalculateY(Server.Time);
           }

You're a genius my friend!

That's it, thanks very much :) It also makes sense, so i can improve in the future. 

Thanks again!


@Giorgi_1