View Full Version : Changing Sessions
10-21-2009, 03:13 PM
In 6.5 I could programatically change the session times by setting ChartControl.SessionBegin and ChartControl.SessionEnd. These properties are no longer available and I'm trying to reproduce this functionality by changing the Bars.Session.TemplateName property. The property changes but the chart does not reflect the change. Is there anything we can use to cause the chart to reflect the new session template?
10-21-2009, 03:54 PM
You would not want to change the template, but rather just the individual sessions begin/end time definitions.
10-22-2009, 08:05 AM
Actually, please clarify what you mean by pro grammatically changing the session times? In 6.5, you could access them via SessionBegin/End, but changing those values would not change anything drawn on the chart. There is no logic to add bars or drop bars depending on what you change SessionBegin/End to.
10-22-2009, 08:42 AM
In 6.5 when you changed either SessionBegin or SessionEnd it would automatically refresh the indicator/chart (similar to pressing F5). The problem was when you changed SessionBegin it would refresh the chart, but, if you then followed up in the code changing SessionEnd it would throw an error because ChartControl was null (I assume because it was in the middle of a refresh, old code was still running, new code was starting up, something along those lines). The trick was to save ChartControl off into another variable and reference that variable when you changed SessionEnd. When SessionEnd was changed it then did another refresh.
Needless to say this was a lot of messing about with things that you all would never recommend, but, it worked. And for me it was handy to have a dropdown on the toobar where I could change the session times without going into the properties dialog.
Is there anyway I could reproduce this functionality within NinjaScript in version 7?
10-22-2009, 08:58 AM
Unfortunately this would not be support (as it wasn't in NT6.5, although it might have worked there with some tricks).