Registered User Joined: 3/16/2011 Posts: 13
|
I am using the following PCF to plot "Close" minus "ATR" line.
C - ((AVGH14 - AVGL14) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13)) / 28)
However, what I need is just the last bar C-ATR value. It could be a dot below the last bar or a horizonatl line at that value.
How would you modify the PCF to achieve it.
Thanks
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There really isn't any sort of built in way to make the dot only plot for the most recent value and not for previous values as well.
About the best we can do is make it so it won't calculate when there are less than the number of bars currently available. The problem with this is that we won't necessarily know how many bars are available. If you have 501 bars available (which will be true during the trading day in a daily time frame for most stocks that have been around that long), you could use the following Indicator Formula.
C - ((AVGH14 - AVGL14) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13)) / 28) + C500 - C500
The + C500 - C500 at the end of the formula is what makes it not calculate when there are less than 501 bars of data available.
The problem is that knowing exactly 501 bars is available isn't something upon which you can count. All time frames start each trading day with the most recent 500 bars of data available if there is that much data.
New bars are added throughout the trading day. This mean a daily time frame gets 1 new bar. A weekly time frame might not get any new bars and a 1-minute time frame would get 390 new bars throughout the trading day for a total of 890 bars of data at the end of the trading day for most stocks.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 3/16/2011 Posts: 13
|
Thanks for the response.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|