Support Board
Date/Time: Wed, 15 Jan 2025 18:47:53 +0000
Post From: Question about how sc.GetBarHasClosedStatus() works
[2017-07-21 20:21:58] |
CustomIndicators - Posts: 126 |
In order to optimize performance in my custom study, I'm trying to use sc.GetBarHasClosedStatus() in order to only check if a pivot point has locked on a subgraph once a candle closes. For example: if (sc.GetBarHasClosedStatus(sc.UpdateStartIndex) == BHCS_BAR_HAS_CLOSED) { if (OSC[sc.Index - 3] < OSC[sc.Index - 2] && OSC[sc.Index - 2] > OSC[sc.Index - 1]) // Locked Pivot { // Draws a dot on the subgraph in order to show me that it has found the pivot at OSC[sc.Index - 2]. } } Before using sc.GetBarHasClosedStatus(), dots appear where the pivot points are on my chart. After putting in the if statement with the sc.GetBarHasClosedStatus(), I'm lucky if it finds 1 pivot when I can clearly see 20+ go by on the chart. I've tried using sc.UpdateStartIndex in the parameter, and not using it. Both don't work the way I intend. Perhaps I'm miss-understanding how sc.GetBarHasClosedStatus() works? Does it return BHCS_BAR_HAS_CLOSED once the current candle locks and becomes sc.Index - 1? Date Time Of Last Edit: 2017-07-21 20:22:20
|