Duration issues of accesing Marketdata.getseries for multi currency

10 May 2019, 15:43Duration issues of accesing Marketdata.getseries for multi currency#1
Rony Sitepuposts: 19since: 30 Jan 2017

Greetings , 

i am trying to  make a currency strenght indicator where it needs to access 28 pairs data of : Bid Price, Day high and Day low.

when initializing the bot, 
it takes around 10 sec for each pairs to get suchs data, and in total would take 200-300 secs to start.

but, after it initialize... it only take 0.016 per loop.

 

this is a some code on how do i extract the data... : 

 

double[] getex(MarketSeries ms)
        {

            double h = 0, l = 10000, p = ms.Close.LastValue;
            int t = Time.DayOfYear;
            int i = 0;



            while (ms.OpenTime.Last(i).DayOfYear == t)
            {



                if (ms.High.Last(i) > h)
                    h = ms.High.Last(i);

                if (ms.Low.Last(i) < l)
                    l = ms.Low.Last(i);

                i++;
            }


            double[] val = new double[] 
            {
                h,
                l,
                p

            };


            return val;





        }

 

My question are : 
1. Why the start up takes too long..? or do i something wrong..?

2. How do i optimize it..?

 

 

Thank you in advance

 

 

13 May 2019, 09:56#2
Panagiotis Charalampousposts: 2715since: 13 Jan 2017

Hi Rony,

It would be more helpful if you could share the complete indicator code.

Best Regards,

Panagiotis


Head of Community Management at cTrader
13 May 2019, 10:22RE:#3
Rony Sitepuposts: 19since: 30 Jan 2017

Panagiotis Charalampous said:

Hi Rony,

It would be more helpful if you could share the complete indicator code.

Best Regards,

Panagiotis

 

 

Can i have your email, so i can send to you privately..?

13 May 2019, 10:28#4
Panagiotis Charalampousposts: 2715since: 13 Jan 2017

Hi Rony,

Send it at community@spotware.com.

Best Regards,

Panagiotis


Head of Community Management at cTrader
13 May 2019, 17:39RE:#5
Rony Sitepuposts: 19since: 30 Jan 2017

Panagiotis Charalampous said:

Hi Rony,

Send it at community@spotware.com.

Best Regards,

Panagiotis

sent

14 May 2019, 09:12#6
Panagiotis Charalampousposts: 2715since: 13 Jan 2017

Hi Rony,

The reason for the delay is because you are loading data for several symbols. See below

 foreach (var pair in symallfil1)
            {

                var hl = getex(MarketData.GetSeries(pair, TimeFrame.Hour));

It takes time because it is a lot of data. You do nothing wrong.

Best Regards,

Panagiotis


Head of Community Management at cTrader
14 May 2019, 09:25RE:#7
Rony Sitepuposts: 19since: 30 Jan 2017

Panagiotis Charalampous said:

Hi Rony,

The reason for the delay is because you are loading data for several symbols. See below

 foreach (var pair in symallfil1)
            {

                var hl = getex(MarketData.GetSeries(pair, TimeFrame.Hour));

It takes time because it is a lot of data. You do nothing wrong.

Best Regards,

Panagiotis

 

 

Thank you again for replying, 


Well, that was the core, i had to access 28 pairs everytime it runs....

so it does takes time , everytime it loads the each series..?
 

 

by the way, 
dont you think it is a great idea if i put the series on external .csv file.
so if i try to load the indicator again ( due to parameter change , etc), it wont have to load it through the API and just load it internally.

then i will only need to update the .csv on every new bar...


Best regards 

RKS.