Replies

tbbusinge
31 Jul 2024, 09:10 ( Updated at: 01 Aug 2024, 05:20 )

RE: RE: RE: Default timeframe set even for Custom Indicators?

PanagiotisCharalampous said: 

tbbusinge said: 

PanagiotisCharalampous said: 

Hi there,

It's a known issue and it will be fixed in an upcoming update.

Best regards,

Panagiotis

Okay thanks for the feedback.
What is your best guess on when this will be done?
Also, is there any work around you recommend, because this project is required in the next few weeks?
 

Unfortunately we do not have an ETA or a workaround at the moment

Okay thanks.

I have found a pretty easy workaround. In case anyone is interested.

Simply create an enum for the timeframes.

public enum TimeFrames
       {
           Daily,
           H4,
           H1,
           M30,
           M15,
           M5,
           M1
       }

And then pass those to whatever indicator you need to use, once you need to use actual timeframes (of type TimeFrame) simply create a switch statement that will reliably map each enum option back to actual timeframes.


switch (RequiredTimeframeName)
           {
               case "Daily":
                   RequiredTimeFrame = TimeFrame.Daily;
                   break;
               case "H4":
                   RequiredTimeFrame = TimeFrame.Hour4;
                   break;
               case "H1":
                   RequiredTimeFrame = TimeFrame.Hour;
                   break;
               case "M30":
                   RequiredTimeFrame = TimeFrame.Minute30;
                   break;
               case "M15":
                   RequiredTimeFrame = TimeFrame.Minute15;
                   break;
               case "M5":
                   RequiredTimeFrame = TimeFrame.Minute5;
                   break;
               case "M1":
                   RequiredTimeFrame = TimeFrame.Minute;
                   break;
               default:
                   break;
           }

Hope that helps.


@tbbusinge

tbbusinge
30 Jul 2024, 12:31

RE: Default timeframe set even for Custom Indicators?

PanagiotisCharalampous said: 

Hi there,

It's a known issue and it will be fixed in an upcoming update.

Best regards,

Panagiotis

Okay thanks for the feedback.
What is your best guess on when this will be done?
Also, is there any work around you recommend, because this project is required in the next few weeks?
 


@tbbusinge

tbbusinge
30 Jul 2024, 09:47 ( Updated at: 30 Jul 2024, 11:45 )

RE: DataSeries Type behaviour

firemyst said: 

The highest index should have the latest value. The indexes in the series also coincide with the bar numbers on the chart.

You can test this yourself by reading the first value, the last value, and comparing against values on the chart.

In layman's terms, if the latest value was kept at index 0, cTrader would have to constantly rewrite the DataSeries updating all the indexes, which is very inefficient. Whereas, just tacking on the last value to the DataSeries List object is the most efficient way - the entirety of the list doesn't have to be constantly updated with each new bar.

Understood, thanks for the reply.
Kindly take a look at my latest query if you have the time.

 


@tbbusinge

tbbusinge
30 Jul 2024, 09:46 ( Updated at: 30 Jul 2024, 11:45 )

RE: DataSeries Type behaviour

PanagiotisCharalampous said: 

Hi there,

If you refer to Bars class, yes it always contains the latest data. Indexing starts from from the oldest data to the newest e.g. Bars.ClosePrices[0] is the oldest close price available.

Best regards,

Panagiotis

Thanks for the response sir. 
Kindly look at my new query if you have the time.


@tbbusinge