Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 8/16/2009 Posts: 42
|
I'm working on an ADX scan and one of the crietera I need is the price to be within 1% of the 20 EMA. So the price could be stilgtly above, sligtly below, or right on the 20 EMA. So, the % value could be adjusted depending on how close I want the price to be to the 20 EMA.
Hope i explained it well. thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could write a Condition Formula for Price being within 1% of the 20-Period Exponential Moving Average as:
100 * ABS(C / XAVGC20 - 1) <= 1
You can adjust the percentage by adjusting the <= 1 to something else.
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/16/2009 Posts: 42
|
Thanks Bruce, the formula was missing a ")"
100 * (ABS(C / XAVGC20) - 1) <= 1
|
|
Registered User Joined: 8/16/2009 Posts: 42
|
Bruce, are you sure this works - i keep getting stocks way away from the 20 EMA. Can you test that one your end? i'm using TC2000.
Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, I'm sure it works.
C / XAVGC20 would produce 1.01 if Price was 1% above the Moving Average. You would get .01 if you subtracted 1 from this.
C / XAVGC20 would produce .99 if Price was 1% below the Moving Average. You would get -.01 if you subtracted 1 from this.
Anything that is between 1% above and 1% below the Moving Average would have to be between .01 and -.01 as a result. If we take the absolute value of the result, this would mean it would have to be at or below .01 to be within 1% of the Moving Average.
We have multiplied the absolute value by 100 to convert it into a percentage. This means when need to set it to be <= 1 to check for price to be between 1% above and 1% below the Moving Average inclusive.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |