Support Board
Date/Time: Sun, 22 Dec 2024 15:46:12 +0000
Post From: ACSIL How to get the time for a bar index in a second Chart?
[2015-08-13 11:27:45] |
Jayturn - Posts: 15 |
Thank you very much for the assistance Sierra Team, you rock! The secondGraphEndBar is a SCDateTime value, it's derived from sc.GetNearestMatchForDateTimeIndex(2, sc.Index - 1). That is how I am getting the previous day's date, if there is a better way you know of to get the previous day's date with sc.Index being the first bar of the current day's session and sc.Index being the last bar of the previous day's session, I'm definitely open to learning how my current logic can be optimized. [Updated] Apologies, you are correct about the code not making sense, I copy and pasted to simplify and in the process messed it up. I am using this logic to get the current day and previous day from the sc.Index: // Get the the previous day's trading date. SCDateTime prevDaySessionEnd = sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.Index - 1]); // Get the open time for the prev day. SCDateTime prevDaySessionStart = sc.GetTradingDayStartDateTimeOfBar(prevDaySessionEnd); // Define the subgraphs we will be working with. SCGraphData secondGraph; // Get the base data for the second chart. sc.GetChartBaseData(2, secondGraph); // Define the first and last bars of the session for the second chart. secondGraphEndBar = sc.GetNearestMatchForDateTimeIndex(2, sc.Index - 1); secondGraphStartBar = sc.GetNearestMatchForSCDateTime(2, prevDaySessionStart); // Loop through the bars. for (int Index = secondGraphStartBar; Index <= secondGraphEndBar; Index++) { // Get the time at the current index for the second chart? SCDateTime currIndexTime = ??? } Date Time Of Last Edit: 2015-08-13 11:45:47
|