Support Board
Date/Time: Tue, 26 Nov 2024 16:49:51 +0000
Post From: Subgraph Extends to Next Time Window
[2023-11-14 17:27:35] |
stockwet - Posts: 32 |
Hi - I have an indicator that produces the high and low of a session period, defined as the 1st hour of trading. It works great, mostly. If I'm just looking at the one session period, all the lines render perfectly. I have a starting time for drawing the lines and an ending time. The lines end correctly. However, if I zoom out enough to see multiple time windows on different days, the lines extend from one time window to the next. How can I prevent this from happening? I based my code on the default High Low indicator and made some changes to calculations, but, the looping is pretty much the same. Here are screenshots of the behavior and the relevant code block rendering the subgraphs. while (true) { if(BackIndex < 0) break; const SCDateTimeMS BackIndexDateTime = sc.BaseDateTimeIn[BackIndex]; const SCDateTimeMS NextBackIndexDateTime = sc.BaseDateTimeIn[BackIndex+1]; bool IsCurrentBarContainingOrGreaterThanStartDateTime = (BackIndexDateTime < StartDateTime && NextBackIndexDateTime > StartDateTime) || BackIndexDateTime >= StartDateTime; if (!OutsideTimeRange && !IsCurrentBarContainingOrGreaterThanStartDateTime) break; Subgraph_HighOfDay[BackIndex] = HighOfPeriod; Subgraph_LowOfDay[BackIndex] = LowOfPeriod; Subgraph_IDRHighOfDay[BackIndex] = IDRHighOfPeriod; Subgraph_IDRLowOfDay[BackIndex] = IDRLowOfPeriod; Subgraph_IDRMid[BackIndex] = IDRMidOfPeriod; Subgraph_BoxOpen[BackIndex] = BoxOpenOfPeriod; Subgraph_BoxClose[BackIndex] = BoxCloseOfPeriod; if (OutsideTimeRange) break; BackIndex--; if(sc.UpdateStartIndex != 0 && BackIndex >= 0) sc.EarliestUpdateSubgraphDataArrayIndex = BackIndex; } |
2023-11-14 11_19_49.png / V - Attached On 2023-11-14 17:24:24 UTC - Size: 59.6 KB - 63 views 2023-11-14 11_20_05.png / V - Attached On 2023-11-14 17:24:31 UTC - Size: 59.97 KB - 49 views |