Bruce,
I wanted to follow up and clarify what I am looking specifically for.
The COUNTTRUE formula in my last post results in creating an oscillator with both positive and negative numbers. That's the reason I have some of the COUNTTRUE statements starting with a -1 which produces a negative number which is what I want. It may not be the ideal way to write the formula but it does work.
What I am really looking for with this formula is the diffence between the current bars formula value versus the value from yesterday (or from 1 min ago, 2 min. ago, whatever time frame being used). So as an example, if the current bars formula value is 4 and yesterday's formula value is 1 then it would return a value of 3 (4-1). Seems like a simple subtraction but with many formulas, I was not sure how to write it.
Since the formula produces negative values, I am looking for both the real difference (like in the example) and how to get the ABSOLUTE difference which would just produce a positive number. Hope this makes sense.
Also, with another software, I created this formula but used an 8 period exponential moving average instead of a the counttrue function for 5 periods (simple not exponential). Is there a way to produce this overall formula using the "xavg" function for each statement within the overall formula? I prefer a more weighted formula (exponential) versus a simple formula.
Thanks for your help in advance.
John
|
Good afternoon,
I have created a PCF that uses several COUNTTRUE functions together.
Here is an example of part of the formula:
counttrue(c>c1 and h>h1 ad l>l1,5) + counttrue(c-o>=max(c-o,9),5) + -1*counttrue(c<c1 and h<h1 and l<l1,5) + -1*counttrue(o-c>=max(o-c,9),5)
I am attempting to create another PCF that will take the difference between today's value a yesterday's value. Could you provide me an example of how to do this?
Also, is there a way to reference an existing PCF in a new PCF without having to write the entire PCF out?
Thank you.
|
You were helping out Chris55 with some questions around having conditions return +1 and/or -1 values. My question is similar.
I understand that a Boolean condition will normally return +1 if true and 0 if not true. How do you write a formula that would return a -1 if true and a 0 if not true?
I have some bullish and bearish conditions that I want to combine in to an oscillator in histogram style so the +1 and -1 are necessary. Currently all the formulas return +1 or 0 and so the indicator never goes in to negative territory.
If conditions cannot return a -1 value, is it possible to have the boolean formula multiplied by -1?
Thank you.
|
If I wanted to create a moving aveage of a single condition or multiple conditions (below), how would I do it?
bbtop2.3>bbtop2.3.1 and bbbot2.3<bbbot2.3.1
Thank you.
|