Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/13/2008 Posts: 35
|
I'd like to create a custom indicator that creates a line displaying the difference between tails up and tails down. The trick, I would suppose, is to determine whether to measure the distance from the open or close of the bar to to high/low.
So a hammer candle would add to the line the length of the tail down minus any tail up (distance from top of candle body to high). Conversely, a shooting star would subtract from the line the length of the tail up minus any tail down. A perfect spinning top would, of course, neither add nor subtract from the line.
I imagine this may be difficult to code since one must first determine which inputs to use based on whether the candle body is solid or hollow, unless there is a function for bodytop and bodybottom.
Is this possible?
|
|
Registered User Joined: 7/13/2008 Posts: 35
|
The purpose of such an indicator, I should add, would be to identify situations in which price is moving up for example, but the indicator is beginning to move down due to longer tails up than down. One would look for divergences between the two to spot a loss of momentum in a particular direction.
|
|
Registered User Joined: 10/27/2004 Posts: 821 Location: Philly area
|
If CLOSE is > OPEN the calculate top tail from the difference between Close and HIgh, for the opposite side reverse the > and use Open and Low - then add or subtract as required from the cumulative total.
|
|
Registered User Joined: 7/13/2008 Posts: 35
|
Exactly right, I just don't know how to program such an indicator.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
hkusp40,
I think you would want to create the following RealCode Indicator:
'# Cumulative
Static Total As Single
If isFirstBar Then Total = 0
Total += (System.Math.Min(Price.Open, Price.Last) - Price.Low) - _
(Price.High - System.Math.Max(Price.Open, Price.Last))
Plot = Total
That said, I'm not sure if the top tail should be subtracted from the bottom tail or vice versa and may have it backwards. I'm also not positive that the Indicator is supposed to be cumulative.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |