I’m tired of jumping to particular time of the day by hand. Is it possible to scroll to particular bar (date and time) via ninjascript? All I found is a feature request SFT-2331 from 2017 about it…
Using custom time frames messes up indicators to that’s not a solution.
I know you can set the price scale using OnCalculateMinMax(), but I’m not aware of a way to do the same for the time scale. You can resize bar spacing from NInjaScript, which may be an acceptable compromise if the jump point is “close enough” that doesn’t make your chart too squished.
You could pluck the scroll bar out of the wpf control tree and set the Value property to change scroll position. ChartControl.GetXByTime() can help mapping DateTimes to X coordinate values.
Copy the trading hours template of the instrument. Edit the end DateTime of each day to be the end of the custom hour you want to view. Adjust your chart so the left side of the Chart shows the Bar at the start of your hour of price action. (I guess what you’re trying to avoid doing repeatedly)…
Now, Create some WPF Button orother control that on each press advances the ‘ChartBars.Properties.To’ property -/+ 24 hours. I did a test and it works, Each press loads exactly 1 hour of price action and indicators still work. The downside is you cannot scroll right past the end of your hour until you reset the template(read below);
You can configure the buttons to automatically load and unload the custom trading hours template with ‘Bars.TradingHours.Name’ property. This way you don’t need to open the DataSeries window and manually select the template. When NT copies a template it just adds a (1) on the name so just add and remove this in the click handler.
I guess if I were doing it I’d have a button that enters into the 1 hour analysis mode and loads the custom template and loads 3 further buttons [+][-][reset].
You could also change the ‘ChartBars.Properties.DaysBack’ property on the click of the initial button, so your 1 hour analysis mode only loads 1-2 days of data so each press of the +/- buttons is very fast. Then when you reset out of the mode set it back to whatever normal number of days you have on your chart.
When you change the ‘ChartBars.Properties.To’ property in code, reloading Ninjascript doesn’t apply it, you have to reload data.
Since it was kind of complex to code it I figured out an easier solution:
I open two charts with global cursor. One chart uses custom time range and the other is regular chart with all the indicators, etc. To navigate to interesting areas - I just move the cursor over the chart with custom time range.