Registered User Joined: 4/3/2012 Posts: 56
|
Hi Bruce,
Im trying to do the follwoing formula but Im not able to get to the correct result and I need some help
What would be the formula for the follwoing
Any time that prices are confined to a range that is within 1.62 times the average range of the last 20 days for 10 days or more or any time prices are confined within one day´s range for 7 days or more.
Please help
thanks
kind regards
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am going to answer the two questions using differing interpretations and techniques so you can decide which (if either) actually meets your needs.
For the first question, I will literally require the total range of the most recent 10 bars to be less than 1.62 times the average range over the most recent 20 bars.
MAXH10 - MINL10 <= 1.62 * AVG(H - L, 20)
For the second, I am going to use brute force to check for between 7 bars in a row and 20 bars in a row inside the range of a single prior bar.
(L7 <= MINL7 AND MAXH7 <= H7) OR (L8 <= MINL8 AND MAXH8 <= H8) OR (L9 <= MINL9 AND MAXH9 <= H9) OR (L10 <= MINL10 AND MAXH10 <= H10) OR (L11 <= MINL11 AND MAXH11 <= H11) OR (L12 <= MINL12 AND MAXH12 <= H12) OR (L13 <= MINL13 AND MAXH13 <= H13) OR (L14 <= MINL14 AND MAXH14 <= H14) OR (L15 <= MINL15 AND MAXH15 <= H15) OR (L16 <= MINL16 AND MAXH16 <= H16) OR (L17 <= MINL17 AND MAXH17 <= H17) OR (L18 <= MINL18 AND MAXH18 <= H18) OR (L19 <= MINL19 AND MAXH19 <= H19) OR (L20 <= MINL20 AND MAXH20 <= H20)
You could combine these formulas by putting an OR in between them.
MAXH10 - MINL10 <= 1.62 * AVG(H - L, 20) OR (L7 <= MINL7 AND MAXH7 <= H7) OR (L8 <= MINL8 AND MAXH8 <= H8) OR (L9 <= MINL9 AND MAXH9 <= H9) OR (L10 <= MINL10 AND MAXH10 <= H10) OR (L11 <= MINL11 AND MAXH11 <= H11) OR (L12 <= MINL12 AND MAXH12 <= H12) OR (L13 <= MINL13 AND MAXH13 <= H13) OR (L14 <= MINL14 AND MAXH14 <= H14) OR (L15 <= MINL15 AND MAXH15 <= H15) OR (L16 <= MINL16 AND MAXH16 <= H16) OR (L17 <= MINL17 AND MAXH17 <= H17) OR (L18 <= MINL18 AND MAXH18 <= H18) OR (L19 <= MINL19 AND MAXH19 <= H19) OR (L20 <= MINL20 AND MAXH20 <= H20)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 4/3/2012 Posts: 56
|
Thanks for the reply Bruce,
One of the problems that I have is that I use an European keyboard so is a mess between the "." and the ",".
So from the first formula MAXH10 - MINL10 <= 1.62 * AVG(H - L, 20) I have created the following
MAXH10 - MINL10 <= (162/100)* (AVGH20 - AVGL20)
Also I have seen that there is a mistake when I try to apply the formula. The 20 days should be before the 10 days and the 10 days should be starting yesterday
Would this formula be correct
MAXH10.1 - MINL.1 <= (162/100)*(AVGH20.11 - AVGL20.11)
Is this formula correct
What about if I want each of the ten previous day starting yestaerday to be below the previous range
would this formula be correct?
((((162/100) * (AVGH20.11 - AVGL20.11)) > (H1-L1)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H2-L2)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H3-L3)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H4-L4)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H5-L5)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H6-L6)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H7-L7)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H8-L8)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H9-L9)) AND (((162/100) * (AVGH20.11 - AVGL20.11)) > (H10-L10)))
Thanks
Kind regards
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You left out the 10 in MINL10.1, but yes, I would think your adjustments make sense based on your clarified requirements.
MAXH10.1 - MINL10.1 <= (162/100) * (AVGH20.11 - AVGL20.11)
Assuming you still want to use the 1.62 factor for the previous range and you are covering the same spans of time, your revised formula comparing each of the previous 10 days to the average range would be correct. Note that this should be less restrictive (return more results) than the first formula comparing the entire range at the same time instead of individual bars.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 4/3/2012 Posts: 56
|
Thanks Bruce¡¡¡
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|