Support Board
Date/Time: Sun, 12 Jan 2025 15:10:53 +0000
[Programming Help] - Spreadsheet study help
View Count: 653
[2017-02-18 12:47:48] |
JRA - Posts: 97 |
I am trying to count(/track/hold on memory) the last bar that gave me the signal with the number of bar that gave me the opposite signal. for example =if(condition1, and ("barsince[condition_buy]" < barsince[condition_sell]"),1,0). Is there a logic function to do this in spreadsheets? Thank you |
[2017-02-18 16:33:04] |
Sawtooth - Posts: 4149 |
There is no 'one solution fits all' for this, but here is the basic idea: Use a Formula Column to create a persistent variable of 'condition buy', e.g. column O: =IF('condition buy',1,IF('condition sell',0,O4)) Use another Formula Column to count bars since 'condition buy', e.g. column P: =IF(AND(O4=1,O3=0),0,IF(O3=1,P4+1,P4)) Use 2 more Formula Columns to repeat for 'sell condition', e.g. columns Q and R Then your example looks like this: =IF(AND(condition1,P3<R3),1,0) Or more simply, like this: =AND(condition1,P3<R3) |
[2017-02-18 17:03:49] |
JRA - Posts: 97 |
Thank you so very much. It was a nightmare to make it work for almost two weeks. Its working perfect. Thanks again!!!! |
To post a message in this thread, you need to log in with your Sierra Chart account: