Login Page - Create Account

Support Board


Date/Time: Tue, 22 Apr 2025 00:03:12 +0000



Post From: Spreadsheet Formula

[2025-02-23 12:52:13]
User431178 - Posts: 654
I was referring to my original formula not being accepted by the study because it wasn't formatted correctly.
It is the line break in the originally posted formula that is the problem (preventing the input), that is what I was getting at with the whitespace comment.

I am still trying to lock in and maintain the same indicator value contained in ID18.SG1 obtained between 11 and 1300 until 17:00, but the value still changes after 1300.
When you say obtained bewteen 1100 and 1300, do you mean the last value of the indicator from that period, I would assume so?

The formula you are using won't work because somewhere it needs a reference to itself at the preceding bar to persist the value.
=IF(AND(BARTIME>=TIME(11, 01,0),BARTIME<=TIME(13,0,0)),ID18.SG1,IF(BARTIME>=TIME(17,00,0),ID18.SG1,ID18.SG1))


Here are three examples:

1. ID2 is the spreadsheet formula, this has been inserted as the final output of the if blocks.
=IF(AND(BARTIME>=TIME(11,0,0),BARTIME<=TIME(13,0,0)),ID18.SG1,IF(BARTIME>=TIME(17,00,0),ID18.SG1,ID2.SG1[-1]))

2. Same as above, but here I have also inlucded a condition so that study acts as a passthrough before 1100 as well.
=IF(AND(BARTIME>=TIME(11,0,0),BARTIME<=TIME(13,0,0)),ID18.SG1,IF(OR(BARTIME<TIME(11,0,0),BARTIME>=TIME(17,0,0)),ID18.SG1,ID2.SG1[-1]))

3. As above but simplified, takes the last value that occurred before 1300 and persists until 1700, otherwise acts as passthrough.
=IF(OR(BARTIME<=TIME(13,0,0),BARTIME>=TIME(17,0,0)),ID18.SG1,ID2.SG1[-1])

Example chartbook attached.
attachmentValuePersistTimeWindow.Cht - Attached On 2025-02-23 12:51:08 UTC - Size: 5.23 KB - 64 views