Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 14:38:28 +0000



[Programming Help] - active formula depend on difference between bars

View Count: 377

[2023-07-26 09:51:15]
User278398 - Posts: 291
i have "spreadsheet formula"(id3) study which active when there is interaction between 2 lines (the blue and the red in the pic), =if(crossover(id1.sg1,id2.sg1),1,0)
....
how can i change the above formula or had another "spreadsheet formula" study which depend on id3 that will be active only if
the last active of id3 was in range that more then 40 bars?

at 11:28:10 will work(the last active was at 11:27:04, and between those two activion there is 66 bars)
at 11:30:12 will work(the last active was at 11:28:50, and between those two activion there is 82 bars)

regards
image121212.png / V - Attached On 2023-07-26 09:44:23 UTC - Size: 182.61 KB - 89 views
Attachment Deleted.
[2023-07-26 15:46:46]
John - SC Support - Posts: 36315
You would have to use the "Spreadsheet Study" for this and use the "GETCORRESPONDINGMATCH()" function along with the "ROW()" function to get the last time the item was true and then check if that row is greater than the number of bars you want.

Refer to the information for these functions on this page:
Spreadsheet Functions
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-26 16:25:14]
Sawtooth - Posts: 4120
You can also do it with another instance of the Spreadsheet Formula study using a formula that counts bars since the crossover:

=IF(CROSSOVER(ID1.SG1,ID2.SG1),1,ID4.SG1[-1]+1)
where ID4 is this Spreadsheet Formula study.

Then reference this study's output for a value >40.
[2023-07-27 07:54:41]
User278398 - Posts: 291
"
You can also do it with another instance of the Spreadsheet Formula study using a formula that counts bars since the crossover:

=IF(CROSSOVER(ID1.SG1,ID2.SG1),1,ID4.SG1[-1]+1)
where ID4 is this Spreadsheet Formula study.

Then reference this study's output for a value >40.
"
i dont really understand:
1.

id3 ( Spreadsheet Formula study ): =IF(CROSSOVER(ID1.SG1,ID2.SG1),1,ID4.SG1[-1]+1)
id4 ( Spreadsheet Formula study ): what i need to write in the formula ?

2.
Then reference this study's output for a value >40 ....
do u mean by study's output is the vertical yellow line that in the pic (i got them by, study subgraph above/below bar as text, and the draw style is background) ?
and how can i change the output for value >40 ( i didnt find something similar to this in the settings study)


regards
[2023-07-27 13:48:07]
Sawtooth - Posts: 4120
i dont really understand

ID4 (Spreadsheet Formula study): =IF(CROSSOVER(ID1.SG1,ID2.SG1),1,ID4.SG1[-1]+1)
This counts the bars since the crossover.

ID5 (Spreadsheet Formula study): =ID4.SG1>=40
This finds a crossover after 40 or more bars since the last crossover.

Adapt this concept to meet your needs.
Date Time Of Last Edit: 2023-07-27 14:06:23
[2023-07-30 09:33:36]
User278398 - Posts: 291
amazing gggggggggg
many thanks
[2023-08-13 08:19:23]
User278398 - Posts: 291
maybe in the same subject:
i'm trying to get triger if the last pick was at list higher by 2.
for exa: the value "6" will be triger because the last value pick is 3.5 (6-3.5 >2),
the value "4.9" will not triger because the last value pick is 3.6 (4.9-3.6<2).

regards.
image112233.png / V - Attached On 2023-08-13 08:15:42 UTC - Size: 27.1 KB - 73 views
[2023-08-13 14:59:25]
Sawtooth - Posts: 4120
You'll need to make the value persistent each time it changes, then subtract the current bar's value from the persistent value's previous value.

You make the value persistent with a formula like this:
Spreadsheet Formula study: =IF(event,ID6.SG1,ID7.SG1[-1])
where ID6 is the value you want to make persistent, and ID7 is this Spreadsheet Formula study.

Then subtract:
=ID6.SG1-ID7.SG1[-1]

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account