Profile Picture

Retrieving frequency via code

Posted By isaacvictorbabani 2 Years Ago
Message
Posted Wednesday January 07 2015
Hi.
Two quick questions:  

1. I have set the Frequency for a strategy to be 5-minutes in the Frequency field of the Properties pane.  This will be a parameter the user can change.  Is it possible to retrieve the frequency the user has selected programatically?  Would there be a SystemParameter that I can use to get this information?

2.  RE has a BarStartTime property.  How can I get the end time of the bar?  I can easily use the Add(TimeSpan) method to do this if I could get the size of the bar (i.e. 5 minutes), but I don't know how to get the bar size via code.  Please advise.  

Thank you.
Posted Thursday January 08 2015
If the system is using a normal time-based frequency, you can get the bar length with this code:
TimeSpan barLength = ((TimeFrequency)SystemData.BarFrequency).BarLength;


As you point out, you should be able to add the bar length to the BarStartTime to get the bar end time.

Thanks,
Daniel
Posted Thursday January 08 2015
Excellent. Thank you.  I did not know about the conversion to the TimeFrequency data type.  This is perfect.  


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems