I have a formula that produces the right results when setComputeOnClose() is set to true, but generates unexpected numbers for the current bar and the bars forward when setComputeOnClose() is not included in preMain. In the latter case, reloading the formula will get the right results for historical bars up to the reloading point, but results for current and future bars after the reloading point will again be calculated incorrectly.
I think it may have something to do with the fact that the global accumulative variable that I use in the formula is calculated with different functions (defined at the end of the same script) in different states, which can occur in the same bar.
Has anyone met the same problem before? Thanks in advance for any suggestions of a solution or reference.
I think it may have something to do with the fact that the global accumulative variable that I use in the formula is calculated with different functions (defined at the end of the same script) in different states, which can occur in the same bar.
Has anyone met the same problem before? Thanks in advance for any suggestions of a solution or reference.
Comment