Support Board
Date/Time: Tue, 24 Dec 2024 18:37:38 +0000
[User Discussion] - Moving average formula help
View Count: 824
[2015-11-06 02:27:14] |
User314747 - Posts: 7 |
I have a particular formula im trying to define. Im currently implementing an 8 moving average strategy (ID11.SG1) and I want to avoid divergences in a minute by minute time frame. Meaning not taking prior trades based on price, for instance if at 9:32:00 price action averages 50.31 and price action at 9:33:00 averages 50.30 I would want to negate (false) the 9:33:00 time frame due to the price action being lower based on the 8 moving average. Below is what I currently am using that has failed to bring results. Thanks for the help, =IF(ID11.SG1@3-62> ID11.SG1@63-122, TRUE, FALSE) |
[2015-11-06 02:45:12] |
User314747 - Posts: 7 |
One more thing...Im also utilizing an underlay on the second chart that is the reasoning for the multiple cells within the formula.
|
[2015-11-06 04:12:05] |
Sawtooth - Posts: 4142 |
You'll need to use the OFFSET function to get the MA value 62 bars previous. (And you can do it without the IF function when you only need a real-time Boolean result.) Try this: =OFFSET(ID11.SG1@3,62,0)>OFFSET(ID11.SG1@63,62,0) |
[2015-11-11 18:00:46] |
User713273 - Posts: 409 |
Wouldnt it be =OFFSET(ID11.SG1@3,62,0)>OFFSET(ID11.SG1@63,122,0) since 3-62 would be referencing the 9:32:00 time frame while 63-122 would be referencing the 9:33:00 timeframe? Thx |
[2015-11-11 23:54:24] |
Sawtooth - Posts: 4142 |
=OFFSET(ID11.SG1@63,122,0) would reference 122 rows(bars) earlier than row 63. (The spreadsheet array is in descending order by time). On a 1 second chart: To reference the first second of the previous minute from the current first second of the current minute (in row 3), the offset is 60: =OFFSET(ID11.SG1@3,60,0) If the current first second of the current minute (in row 3) is 09:34:00 then =OFFSET(ID11.SG1@3,60,0) references the 09:33:00 bar. =OFFSET(ID11.SG1@63,60,0) would reference the 09:32:00 bar. =OFFSET(ID11.SG1@63,120,0) would reference the 09:31:00 bar. This assumes there is a bar printed each second. To assure this, go to Chart Settings >> Advanced Settings and check 'Include Columns With No Data'. |
To post a message in this thread, you need to log in with your Sierra Chart account: