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 |

TTM Trend Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
lakotaeagle
Posted : Friday, April 26, 2013 11:16:22 PM
Registered User
Joined: 12/23/2010
Posts: 10

Can someone please help me to develop a PCF to find the condition when:

High of today is greater than 50% above the average range of the previous 5 candlesticks

I developed this one but it doesn't work at all:   H>0.51*(ABS((H5-L5)+(H4-L4)+(H3-L3)+(H2-L2)+(H1-L1))/5)

All help will be greatly appreciated.

 

 

Bruce_L
Posted : Monday, April 29, 2013 9:33:13 AM


Worden Trainer

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

Price and the range of price use the same units, but they are rarely close to each other in value. The range of price is usually much lower in value than price itself. This means your formula and the very concept of your formula will almost always return true for most stocks.

You would generally need to check for price to be above something that is close to the value of price (such as the open, high, low, close, midpoint or moving average of price) plus some multiple of the range of price to create a formula which is going to have a result which could be either true or false for most symbols instead of almost always being true or almost always being false.

That said, what I suspect is of interest is if the high is above the average midpoint of the 5-bars ending 1-bar ago:

H > (AVGH5.1 + AVGL5.1) / 2

Or above the actual midpoint of the total range of the 5-bars ending 1-bar ago:

H > (MAXH5.1 + MINL5.1) / 2

PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Monday, April 29, 2013 10:34:18 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

Bruce
Some things to try if they can be done.

Close greater than simple average close of previous five bars.
All bars Heikin Ashi.

Close greater than simple average midpoint of prevous five bars.
All bars Heikin Ashi.

Close greater than actual midpont of high low range prevous five bars.
All bars Heikin Ashi.

 

 

 

Thanks

Bruce_L
Posted : Monday, April 29, 2013 11:22:00 AM


Worden Trainer

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

QUOTE (diceman)
Close greater than simple average close of previous five bars.
All bars Heikin Ashi.

O + H + L + C > AVGO5.1 + AVGH5.1 + AVGL5.1 + AVGC5.1

QUOTE (diceman)
Close greater than simple average midpoint of prevous five bars.
All bars Heikin Ashi.

O + H + L + C > AVGH5.1 + AVGL5.1 + (AVG(XAVGO3.2,5) + AVG(XAVGH3.2,5) + AVG(XAVGL3.2,5) + AVG(XAVGC3.2,5)) / 2 + (ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4) - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4) + ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4) - ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4) + ABS(H3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4) - ABS(L3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4) + ABS(H4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4) - ABS(L4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4) + ABS(H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4) - ABS(L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)) / 5

QUOTE (diceman)
Close greater than actual midpont of high low range prevous five bars.
All bars Heikin Ashi.

O + H + L + C > ((H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+H2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 + ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 - ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))+2*(H3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.1) / 4 + ABS(H3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4))+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+H2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 + ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 - ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))-2*(H3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.1) / 4 + ABS(H3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4)))+2*(H4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.1) / 4 + ABS(H4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)+H5 + (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.1) / 4 + ABS(H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)+ABS(H4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.1) / 4 + ABS(H4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)-H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.1) / 4 - ABS(H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)))+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+H2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 + ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 - ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))+2*(H3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.1) / 4 + ABS(H3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4))+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+H2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 + ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)+ABS(H1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.1) / 4 + ABS(H1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.1) / 4 - ABS(H2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))-2*(H3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.1) / 4 + ABS(H3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4)))-2*(H4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.1) / 4 + ABS(H4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)+H5 + (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.1) / 4 + ABS(H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)+ABS(H4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.1) / 4 + ABS(H4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)-H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.1) / 4 - ABS(H5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4))))) + (L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+L2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 - ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 + ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))+2*(L3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4 - ABS(L3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4))-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+L2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 - ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 + ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))-2*(L3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4 - ABS(L3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4)))+2*(L4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4 - ABS(L4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)+L5 + (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4 - ABS(L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)-ABS(L4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4 - ABS(L4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)-L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4 + ABS(L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)))-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+L2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 - ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 + ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))+2*(L3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4 - ABS(L3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4))-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)+L2 + (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 - ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4)-ABS(L1 + (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4 - ABS(L1 - (XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2) / 4)-L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4 + ABS(L2 - (XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3) / 4))-2*(L3 + (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4 - ABS(L3 - (XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4) / 4)))-2*(L4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4 - ABS(L4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)+L5 + (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4 - ABS(L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)-ABS(L4 + (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4 - ABS(L4 - (XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5) / 4)-L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4 + ABS(L5 - (XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6) / 4)))))) / 8

haDelta
Min Max PCFs



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
lakotaeagle
Posted : Monday, April 29, 2013 10:48:46 PM
Registered User
Joined: 12/23/2010
Posts: 10

Bruce - thank you very much.

tkamada
Posted : Wednesday, June 19, 2013 9:38:33 AM
Registered User
Joined: 3/31/2011
Posts: 68

Bruce,

How would you write these two?

1.

The average closing price of the prior six bars is in the upper 50% of the trading range.
 
2.

The average closing price of the prior six bars is in the lower 50% of the trading range.


Thank you.




 

Bruce_L
Posted : Wednesday, June 19, 2013 9:46:19 AM


Worden Trainer

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

QUOTE (tkamada)
The average closing price of the prior six bars is in the upper 50% of the trading range.

2 * AVGC6 >= MAXH6 + MINL6 AND MAXH6 > MINL6

QUOTE (tkamada)
The average closing price of the prior six bars is in the lower 50% of the trading range.

2 * AVGC6 <= MAXH6 + MINL6 AND MAXH6 > MINL6



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
tkamada
Posted : Wednesday, June 19, 2013 9:48:08 AM
Registered User
Joined: 3/31/2011
Posts: 68

Bruce,

Thank you for your help.

T.Kamada

tkamada
Posted : Wednesday, June 19, 2013 12:41:34 PM
Registered User
Joined: 3/31/2011
Posts: 68

Bruce,

I have one more question. Are those formulas still the same if Heikin-ashi bars are used?

Thank you.

QUOTE (Bruce_L)

QUOTE (tkamada)
The average closing price of the prior six bars is in the upper 50% of the trading range.

2 * AVGC6 >= MAXH6 + MINL6 AND MAXH6 > MINL6

QUOTE (tkamada)
The average closing price of the prior six bars is in the lower 50% of the trading range.

2 * AVGC6 <= MAXH6 + MINL6 AND MAXH6 > MINL6

Bruce_L
Posted : Wednesday, June 19, 2013 1:05:45 PM


Worden Trainer

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

No, the formulas for regular bars and HA bars are not even close.

QUOTE (tkamada)
The average closing price of the prior six bars is in the upper 50% of the trading range.

AVGO6 + AVGH6 + AVGL6 + AVGC6 >= ((4 * MAXH6+XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1+ABS(4 * MAXH6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)+XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2+XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3+ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3)+ABS(4 * MAXH6+XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1+ABS(4 * MAXH6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)-XAVGO3.2 - XAVGH3.2 - XAVGL3.2 - XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3-ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3))+XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4+XAVGO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GO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4-XAVGO3.5 - XAVGH3.5 - XAVGL3.5 - XAVGC3.5)-2*(XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6))))) / 16

QUOTE (tkamada)
The average closing price of the prior six bars is in the lower 50% of the trading range.

AVGO6 + AVGH6 + AVGL6 + AVGC6 <= ((4 * MAXH6+XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1+ABS(4 * MAXH6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)+XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2+XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3+ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3)+ABS(4 * MAXH6+XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1+ABS(4 * MAXH6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)-XAVGO3.2 - XAVGH3.2 - XAVGL3.2 - XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3-ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3))+XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4+XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5+ABS(XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4-XAVGO3.5 - XAVGH3.5 - XAVGL3.5 - XAVGC3.5)+2*(XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6)+ABS(XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4+XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5+ABS(XAVGO3.4 + XA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4 * MINL6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)+XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2+XAVGO3.3 + XAVGH3.3 + XAVGL3.3 + XAVGC3.3-ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3)-ABS(4 * MINL6+XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1-ABS(4 * MINL6-XAVGO3.1 - XAVGH3.1 - XAVGL3.1 - XAVGC3.1)-XAVGO3.2 - XAVGH3.2 - XAVGL3.2 - XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3+ABS(XAVGO3.2 + XAVGH3.2 + XAVGL3.2 + XAVGC3.2-XAVGO3.3 - XAVGH3.3 - XAVGL3.3 - XAVGC3.3))-XAVGO3.4 - XAVGH3.4 - XAVGL3.4 - XAVGC3.4-XAVGO3.5 - XAVGH3.5 - XAVGL3.5 - XAVGC3.5+ABS(XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4-XAVGO3.5 - XAVGH3.5 - XAVGL3.5 - XAVGC3.5)-2*(XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6)+ABS(XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4+XAVGO3.5 + XAVGH3.5 + XAVGL3.5 + XAVGC3.5-ABS(XAVGO3.4 + XAVGH3.4 + XAVGL3.4 + XAVGC3.4-XAVGO3.5 - XAVGH3.5 - XAVGL3.5 - XAVGC3.5)-2*(XAVGO3.6 + XAVGH3.6 + XAVGL3.6 + XAVGC3.6))))) / 16



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
tkamada
Posted : Wednesday, June 19, 2013 1:10:27 PM
Registered User
Joined: 3/31/2011
Posts: 68

Bruce,

Thank you. I appreciate your help.

T.Kamada

Telework
Posted : Saturday, February 8, 2014 1:42:15 AM
Registered User
Joined: 1/12/2011
Posts: 183

I tried out all of the various formulas posted above but none of them match the TTM Trend indicator. I think the issue may be that the Heiken-Ashi Opening price should be based on an average of the previous days open and close price. Therefore simply using Open (O) in the formula does not give an accurate Heiken-Ashi opening price.

TTM Trend with default settting is defined as a Closing price greater than the average of the previous 6 days closing price. All bars are Heiken-Ashi.

I tried both of these formulas but neither is accurate to the built in version of the indicator in TOS.

O + H + L + C > AVGO6.1 + AVGH6.1 + AVGL6.1 + AVGC6.1

C > (AVGO6.1 + AVGH6.1 + AVGL6.1 + AVGC6.1) / 4

I'm wondering if one of these formulas might be the correct one IF the opening price was a proper Heiken-Ashi opening price (average of the previous days open and close price).

Any additional thoughts on how to replicate this indicator?

 

Telework
Posted : Saturday, February 8, 2014 1:44:49 AM
Registered User
Joined: 1/12/2011
Posts: 183

Apparently there is more to a proper calculation of Heiken-Ashi bars.

1. The Heikin-Ashi Close is simply an average of the open, 
high, low and close for the current period. 

HA-Close = (Open(0) + High(0) + Low(0) + Close(0)) / 4

2. The Heikin-Ashi Open is the average of the prior Heikin-Ashi 
candlestick open plus the close of the prior Heikin-Ashi candlestick. 

HA-Open = (HA-Open(-1) + HA-Close(-1)) / 2 

3. The Heikin-Ashi High is the maximum of three data points: 
the current period's high, the current Heikin-Ashi 
candlestick open or the current Heikin-Ashi candlestick close. 

HA-High = Maximum of the High(0), HA-Open(0) or HA-Close(0) 

4. The Heikin-Ashi low is the minimum of three data points: 
the current period's low, the current Heikin-Ashi 
candlestick open or the current Heikin-Ashi candlestick close.

HA-Low = Minimum of the Low(0), HA-Open(0) or HA-Close(0) 
Telework
Posted : Saturday, February 8, 2014 2:43:46 AM
Registered User
Joined: 1/12/2011
Posts: 183

Here are a couple more formulas I created... but there are too many false signals compared to the original indicator. Still struggling with this.

(((O1 + C1) / 2) + H + L + C) / 4 > (((((O7 + C7) / 2) + H6 + L6 + C6) / 4) + ((((O6 + C6) / 2) + H5 + L5 + C5) / 4) + ((((O5 + C5) / 2) + H4 + L4 + C4) / 4) + ((((O4 + C4) / 2) + H3 + L3 + C3) / 4) + ((((O3 + C3) / 2) + H2 + L2 + C2) / 4) + ((((O2 + C2) / 2) + H1 + L1 + C1) / 4)) / 6

 

C > (((((O7 + C7) / 2) + H6 + L6 + C6) / 4) + ((((O6 + C6) / 2) + H5 + L5 + C5) / 4) + ((((O5 + C5) / 2) + H4 + L4 + C4) / 4) + ((((O4 + C4) / 2) + H3 + L3 + C3) / 4) + ((((O3 + C3) / 2) + H2 + L2 + C2) / 4) + ((((O2 + C2) / 2) + H1 + L1 + C1) / 4)) / 6

Telework
Posted : Saturday, February 8, 2014 5:13:45 AM
Registered User
Joined: 1/12/2011
Posts: 183

Here's another take on it based on a description from John Carter at 2:18 in this video.

http://www.tradethemarkets.com/public/Review_on_How_I_Read_Charts.cfm

If the midpoint of the current bar is above the Heiken Ashi average closing price of the previous 6 days then the bar is marked as being in an uptrend.

(H + L) / 2 > (((((O7 + C7) / 2) + H6 + L6 + C6) / 4) + ((((O6 + C6) / 2) + H5 + L5 + C5) / 4) + ((((O5 + C5) / 2) + H4 + L4 + C4) / 4) + ((((O4 + C4) / 2) + H3 + L3 + C3) / 4) + ((((O3 + C3) / 2) + H2 + L2 + C2) / 4) + ((((O2 + C2) / 2) + H1 + L1 + C1) / 4)) / 6

Interested in thoughts or confirmation that this is correct. The formula still doesn't match the results I see in TOS but it is useable.

Telework
Posted : Monday, February 10, 2014 1:09:54 AM
Registered User
Joined: 1/12/2011
Posts: 183

After trying a lot of different things, this is what I am using for now. It's relatively close to TTM Trend but tends to flash opposing signals in some cases where TTM Trend would still keep you in the move.

(AVGH6.1 + AVGL6.1) / 2 < (((((O6 + C6) / 2) + H5 + L5 + C5) / 4) + ((((O5 + C5) / 2) + H4 + L4 + C4) / 4) + ((((O4 + C4) / 2) + H3 + L3 + C3) / 4) + ((((O3 + C3) / 2) + H2 + L2 + C2) / 4) + ((((O2 + C2) / 2) + H1 + L1 + C1) / 4) + ((((O1 + C1) / 2) + H + L + C) / 4)) / 6

I'm still looking for additional feedback from anyone who has more insight on the TTM Trend formula or who has created a more accurate representation.

 

 

diceman
Posted : Monday, February 10, 2014 10:27:19 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

QUOTE (Telework)

I'm still looking for additional feedback from anyone who has more insight on the TTM Trend formula or who has created a more accurate representation.

 

I know in TradeStation the code works like this:

 

First Bar:

HaOpen=OPEN

HaClose=(O+H+L+C)/4

 

After that:

HaOpen=(HaOpen yesterday+HaClose yesterday)/2

HaClose=(O+H+L+4)/4

I dont think this can be done exactly in Telechart because youre

accessing a running calculation.

(you can only simulate it or get close)

 

Thanks

 

 

 

Telework
Posted : Monday, February 10, 2014 1:18:06 PM
Registered User
Joined: 1/12/2011
Posts: 183

diceman, you have posted the formulas for calculating a Heiken-Ashi bar, but not the TTM Trend which is based on Average Range of the last 6 bars residing above or below the midpoint of the current Heiken-Ashi MA (6 bar moving average I think).

Do you have access to the full TTM Trend code in TradeStation that might give us more information?

Thanks

diceman
Posted : Monday, February 10, 2014 3:09:12 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

Yes, after the initial calc:

 

 

 

if haClose > haOpen then color = UpColor

else color = DnColor;

 

for value1 = 1 to CompBars

begin

if haOpen <= MaxList(haOpen[value1],haClose[value1]) and

haOpen >= MinList(haOpen[value1],haClose[value1]) and

haClose <= MaxList(haOpen[value1],haClose[value1]) and

haClose >= MinList(haOpen[value1],haClose[value1]) then

color = color[value1];

end;

 

 

If youre not familiar with TS language.

 

Just off the top of my head.

 

Value1 to Compbars is a For Next loop

(Compbars is the 6 and sets the lookback period value1 is the counter)

 

Maxlist is the highest value within the parentheses.

Minlist is the lowest.

 

So its comparing today's haopen and haclose to those lists each bar back until 6 back.

 

I suspect this loop is what keeps the color from switching. (until an actual change)

I just haven't had the time to look at it.

 

 

 

Thanks

 

 

 

 

 

Telework
Posted : Monday, February 10, 2014 4:48:12 PM
Registered User
Joined: 1/12/2011
Posts: 183

I don't fully get it.  Maybe Bruce or someone else would be able to translate that into a PCF formula based on Compbars = 6

Telework
Posted : Sunday, July 24, 2016 1:19:33 AM
Registered User
Joined: 1/12/2011
Posts: 183

diceman or Bruce,   do either of you have the know-how to translate the Tradestation code above into TC2000 PCF? 

I'm revisiting this topic and would really like to understand this original code better.

Thanks in advance.

Bruce_L
Posted : Monday, July 25, 2016 11:40:15 AM


Worden Trainer

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

QUOTE (diceman)
First Bar:

HaOpen=OPEN

HaClose=(O+H+L+C)/4

 

After that:

HaOpen=(HaOpen yesterday+HaClose yesterday)/2

HaClose=(O+H+L+4)/4

I dont think this can be done exactly in Telechart because youre

accessing a running calculation.

(you can only simulate it or get close)

HA Open really can be safely written as follows.

(XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4

And HA Close is always exactly:

(O + H + L + C) / 4

The initilization condition of using O for HA Open for the first bar is going to very, very quickly get reduced to not affecting the value in any significant way. I would be quite impressed if it were noticable after 15 terms (or 5 times the period of the EMA being used).

All of the other terms besides the oldest term in the HA Open calculation are using (O + H + L + C) / 4, so the O for the first bar is pretty much meaningless. The amount of historical data used is going to affect the values of these early bars more than the initialization value for example if the number of bars doesn't match exactly.



-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.