Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

net vs absolute difference Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
hawkeyejjl
Posted : Thursday, April 3, 2014 8:46:28 PM
Registered User
Joined: 5/16/2011
Posts: 108

Hi:

What is the definition of net vs absolute difference in the following code?

Thanks,

Jeff

---------------------------------------------------------------------------------------------

 

If you mean the Net Difference then:

'|****************************************************************** 
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder ********* 
'|*** Indicator:Jeff Open vs Close Net  
'|****************************************************************** 
Static Basis As Single 
If isFirstBar Then 
    Basis = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then 
    Basis = Price.Last 
End If 
Plot = Price.Last - Basis

If you mean the Absolute Difference then:

'|****************************************************************** 
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com 
'|*** Copy and paste this header and code into StockFinder ********* 
'|*** Indicator:Jeff Open vs Close Absolute
'|****************************************************************** 
Static Basis As Single 
If isFirstBar Then 
    Basis = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then 
    Basis = Price.Last 
End If 
Plot = System.Math.Abs(Price.Last - Basis)

-----------------------------------------------------------------------------------------------

 

Bruce_L
Posted : Friday, April 4, 2014 9:49:15 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The net difference between the open and the current price can be positive, negative or zero. For example, if the open (Basis) is $100 and the current price (Price.Last) is $99, then Price.Last - Basis would be -1 but if the open had been $98 instead, then Price.Last - Basis would be 1.

The absolute difference only considers the magnitude of the difference and does not care if the result is positive or negative. It converts negative numbers into positive numbers and leaves everything else unchanged. So in the example above the absolute difference would be 1 both when the open was $100 and when the open was $98.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
trout2
Posted : Friday, April 4, 2014 11:24:06 AM
Registered User
Joined: 12/9/2008
Posts: 30

Hi Bruce,    I was sent an email  answer however, I asked a different question.   I am in need of this:  After 4 or more down days a Gravestone doji candle appears and the stock closes above  $1.00. Or a Dragonfly doji candle appears   or a long legged hammer appear. Or would  a formula for  just any doji appearing  be doable.  (the Gravestone/dragonfly/longlegged hammer would be best ) Thank You & my fingers are crossed.      Arnie

Bruce_L
Posted : Friday, April 4, 2014 11:30:18 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

What follows is the answer I already gave in the Not a True Gap topic.

Learn how to use the forums: post a new topic, reply, Search existing topics

So a Dragonfly Doji where a True Doji with the open and close being exactly equal happens in the top third of the candle could be written as:

H - C < (H - L) / 3 AND O = C AND C > 1 AND C1 < C2 AND C2 < C3 AND C3 < C4 AND C4 < C5

A Gravestone Doji where a True Doji with the open and close being exactly equal happens in the bottow third of the candle could be written as:

C - L < (H - L) / 3 AND O = C AND C > 1 AND C1 < C2 AND C2 < C3 AND C3 < C4 AND C4 < C5

A Hammer where both the open and close are in the top third of the candle could be written as:

H - O < (H - L) / 3 AND H - C < (H - L) / 3 AND C > 1 AND C1 < C2 AND C2 < C3 AND C3 < C4 AND C4 < C5

And an Inverted Hammer where both the open and close are in the bottom third of the candle could be written as:

O - L < (H - L) / 3 AND C - L < (H - L) / 3 AND C > 1 AND C1 < C2 AND C2 < C3 AND C3 < C4 AND C4 < C5

None of these formulas have any restrictions on the size of the overall size of the current candle. If your definitions are different, then the formulas would need to be different as well.

For example, the formulas check for four down days in a row using just closing prices. If you define a down day as the close being below the open, this would need to change in the formula. If you want the hammer formulas to explicitly exclude dojis, you would need to specify that in the formula. If you want to use something other than the top and bottom third of the candle for the body locations, that would need to be changed.

Boolean PCFs for Candlestick Patterns



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.