Support Board
Date/Time: Thu, 28 Nov 2024 00:44:45 +0000
Post From: Plots into the forward space disappear when new bar starts
[2023-06-22 17:03:59] |
WarEagle - Posts: 73 |
I have several custom indicators that plot into the future or forward space of the chart. Since these calculations are complex but only need to be made once, I run this code only on the first bar for efficiency. The problem I have is that when a new bar starts, the forward part of the plot disappears. If I recalculate the chart manually the forward plot reappears until the next new bar starts when it disappears again. It is like anything in the forward array is deleted with a new bar. This is not a big deal on daily charts but it becomes a pain on intraday charts that update frequently. I am assuming the issue is related to the code only calculating on the first bar but I can't figure out what I need to do to fix it. I tried running the calculations for just the future portion on the current bar and it solves the problem of the future plot disappearing but this causes the calculation to occur every tick and it is really slowing things down. I tried checking GetBarHasClosedStatus() of the current bar to avoid calculations when it has not closed but once the bar closes it moves to the next index number so the code never runs. Or maybe it runs but the new bar instantly deletes the future plot again. Is there some property I have overlooked or a way around this problem? Thank you |