Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 08:39:34 +0000



Post From: bars since alert

[2024-03-20 04:13:29]
User486817 - Posts: 83
hello,

i'm trying to count the number of bars since an event using the following instructions here: Spreadsheet Example Formulas and Usage: Formula to Count Bars Since An Event

here is what i have done:

1. added spreadsheet study to chart
2. input the new spreadsheet name as per these instructions #5: Using the Spreadsheet Study
3. i currently have a .scss file added to my chartbook with the corresponding spreadsheet study on my chart.

now, going back to Spreadsheet Example Formulas and Usage: Formula to Count Bars Since An Event

the instructions state: "The following formula will count the number of bars since a Buy Entry event occurred (cell K3). This will also stop counting if a Sell Entry event occurs (cell M3). This could be used to cancel an unfilled Order at some number of bars."

therefore, in cell K3 i am to input the buy event formula and in cell M3 i am to input the sell event formula. on my chart at ID16 i have the color bar based on alert condition study, which is my buy alert. ID17 is my sell alert. i have copied and pasted IF(ID16.SG1<>0, 1, 0) into cell K3, representing if the buy formula is true. i also input =IF(ID17.SG1<>0, 1, 0) into cell M3, representing the sell alert. these formulas were accepted with no error.

i went on to the next step and copied the formula as-is from here: Spreadsheet Example Formulas and Usage: Formula to Count Bars Since An Event

to count the number of bars from the buy alert, i input =IF(M3, 0,IF(OR(K3, P4 > 0), P4 + 1, P4)) into cell P3. to count bars from the sell alert, i entred =IF(K3, 0,IF(OR(M3, Q4 > 0), Q4 + 1, Q4)) into cell Q3. both columns P and Q return #VALUE! error outputs.

can you please help by showing me what i have done wrong?
Date Time Of Last Edit: 2024-03-20 04:15:11