Registered User Joined: 12/5/2008 Posts: 70
|
I'm using a HeikenAshi price plot and I know there is a ' Heiken Ashi Diff' indicator which is basically a 3 day moving average of the plot -- I think. any info or help would be greatly appreciated on its availability in Tc 2000 or point me to how I can get started in trying a PCF.
Thanks in advance
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I thought I'd been asked for this in the past and it was the difference between the HA close and HA open, but I can't find it.
(O + H + L + C - XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1) / 4
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/5/2008 Posts: 70
|
OK Thank You
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If it is not what you want I can provide something else if you provide some additional clarification as to the actual definition of Heiken-Ashi Diff.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/5/2008 Posts: 70
|
HA Close = ( O+H+C+L)/4
HA Open = (previous HA Open + previous HA Close)/2
HA Diff = The Diff between the HA Close and the HA Open
I'm trying to formulate a plot for the HA Diff but on a standard candlestick chart. The HA Close is straightforward, but a problem arises with the HA Open because it requires a previous HA Open.This is not readily available on a standard candlestick chart. Any help would be appreciated. Thank you
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Because of the math of the HA open, it can be replicated with a 3 period exponential moving average (the math for the HA open is the same as the math for a 3 period EMA).
(XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4
So the formula given in my Tuesday, October 27, 2015 10:16:23 AM ET post should be correct.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/5/2008 Posts: 70
|
The first HA Open is (O+C)/2 because at that point there is no previous HA Open. It seems that an "if...then" would solve this problem but I'm not familiar enough with Worden PCF's to work this out. Thinkorswim has a command titled "CompareValue" which allows for the first data in the series to not be a previous value. Do PCF's have a similiar command? Also, am I wrong in assuming that in your formula for HA Open the OHLC should be added instead of subtracted?
Thank You
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You would need the ability to reference the value of the previous bar and do multiplication on it. You would also need the abilitiy to know if it is the first bar or not. Neither is available.
An "if...then" construct is possible to some extent by placing boolean expressions inside of () or ABS() functions. Putting the boolean inside of () will produce -1 if true and 0 if false. Putting a boolean inside of ABS() will produce 1 if true and 0 if false. This does not help in this particular situation.
You don't need to do this in the case Heiken-Ashi charts anyway though. It is pretty much a waste of code and resources to do so even if the programming language supports it.
The first HA open being (O + C) / 2 is pretty much meaningless after less than 18 bars of data (usually quite a few bars less).
Keep in mind that the math involved means that each older bar contributes only half the weight to the final calculations as the bar which follows it. That means older bars contribute almost nothing to the current result very, very quickly.
The largest weight comes from the previous HA Close and this is 1/2 the value.
The contribution of the HA Close before is 1/4 the value.
The contirbution of the HA Close before is 1/8 the value.
Then 1/16, then 1/32, then 1/64, then 1/128, then 1/256, then 1/1024. At this point we are down to the oldest bar contributing less than 1 part in 1000 to the result. At twice this many bars we would already be down to less than 1 part in a million.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|