Registered User Joined: 11/16/2004 Posts: 64
|
I want to find the max difference (spread) between the highest high and the 20 simple moving average of the close in last 15 days. I know that MaxH15 - AvgC20 does not cut it as it compares the max hi to the current m.a. I need the HH and Close to be compared on each individula day. Can you give me a shove in correct direction?
Thanks
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
We can use the techniques in the Min Max PCFs topic to create an Indicator Formula for this. Assuming you are interest in an absolute spread and not a directional spread, it could be written as:
(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))+2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4)))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))-2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4))))+ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))+2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9))))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))+2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4)))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))-2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4))))-ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6)-ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7))-ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))-ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))))+ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))+2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14)))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))-2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14))))+ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))+2*(ABS(H17 - AVGC20.17))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))+2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))+2*(ABS(H17 - AVGC20.17))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19))))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))+2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14)))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))-2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14))))-ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16)-ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))+2*(ABS(H17 - AVGC20.17))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))+2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4)))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))-2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4))))+ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))+2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9))))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))+2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4)))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))+2*(ABS(H2 - AVGC20.2))+ABS(ABS(H - AVGC20)+ABS(H1 - AVGC20.1)+ABS(ABS(H - AVGC20)-ABS(H1 - AVGC20.1))-2*(ABS(H2 - AVGC20.2)))-2*(ABS(H3 - AVGC20.3)+ABS(H4 - AVGC20.4)+ABS(ABS(H3 - AVGC20.3)-ABS(H4 - AVGC20.4))))-ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6)-ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7))-ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))-ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))+2*(ABS(H7 - AVGC20.7))+ABS(ABS(H5 - AVGC20.5)+ABS(H6 - AVGC20.6)+ABS(ABS(H5 - AVGC20.5)-ABS(H6 - AVGC20.6))-2*(ABS(H7 - AVGC20.7)))-2*(ABS(H8 - AVGC20.8)+ABS(H9 - AVGC20.9)+ABS(ABS(H8 - AVGC20.8)-ABS(H9 - AVGC20.9)))))-ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11)-ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12))-ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))-2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14)))-ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))-2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14))))-ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16)-ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))+2*(ABS(H17 - AVGC20.17))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19))))-ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))+2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14)))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))+2*(ABS(H12 - AVGC20.12))+ABS(ABS(H10 - AVGC20.10)+ABS(H11 - AVGC20.11)+ABS(ABS(H10 - AVGC20.10)-ABS(H11 - AVGC20.11))-2*(ABS(H12 - AVGC20.12)))-2*(ABS(H13 - AVGC20.13)+ABS(H14 - AVGC20.14)+ABS(ABS(H13 - AVGC20.13)-ABS(H14 - AVGC20.14))))-ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16)-ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))-ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))+2*(ABS(H17 - AVGC20.17))+ABS(ABS(H15 - AVGC20.15)+ABS(H16 - AVGC20.16)+ABS(ABS(H15 - AVGC20.15)-ABS(H16 - AVGC20.16))-2*(ABS(H17 - AVGC20.17)))-2*(ABS(H18 - AVGC20.18)+ABS(H19 - AVGC20.19)+ABS(ABS(H18 - AVGC20.18)-ABS(H19 - AVGC20.19)))))))/32
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 11/16/2004 Posts: 64
|
Wow! Had no idea it would be so complex. And it WORKS! Very impressive.Would it be more or less complex if it was directional? Greater or less than 20 ma?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Before we explore the directional version, let me mention that it is actually possible to do this in a much easier fashion if you are doing something that doesn't require a formula.
Add a Custom PCF Indicator with the following settings:
- Period: 1
- Average Type: Doesn't matter (because the Period is 1)
- Formula: ABS(H - AVGC20)
Then add Donchian Channels setting with a period of 20 and an offset of 0. You can click on the Donchian Channels and select Create Scan Conditions or Show Values in WatchList to get the value of the top Donchian Channel or use it in a Condition.
Creating Conditions from Your Chart
The formula should actually be a bit shorter if you mean the actual highest value of a directional spread. It is just a matter of replacing every instance of ABS(H with (H instead (including in the Custom PCF Indicator above).
((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))+2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4)))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))-2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4))))+(H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))+2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9))))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))+2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4)))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))-2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4))))-(H5 - AVGC20.5)-(H6 - AVGC20.6)-ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7))-ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))-ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))))+(H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))+2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14)))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))-2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14))))+(H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))+2*((H17 - AVGC20.17))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))+2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))+2*((H17 - AVGC20.17))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19))))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))+2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14)))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))-2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14))))-(H15 - AVGC20.15)-(H16 - AVGC20.16)-ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))+2*((H17 - AVGC20.17))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))+2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4)))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))-2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4))))+(H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))+2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9))))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))+2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4)))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))+2*((H2 - AVGC20.2))+ABS((H - AVGC20)+(H1 - AVGC20.1)+ABS((H - AVGC20)-(H1 - AVGC20.1))-2*((H2 - AVGC20.2)))-2*((H3 - AVGC20.3)+(H4 - AVGC20.4)+ABS((H3 - AVGC20.3)-(H4 - AVGC20.4))))-(H5 - AVGC20.5)-(H6 - AVGC20.6)-ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7))-ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))-ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))+2*((H7 - AVGC20.7))+ABS((H5 - AVGC20.5)+(H6 - AVGC20.6)+ABS((H5 - AVGC20.5)-(H6 - AVGC20.6))-2*((H7 - AVGC20.7)))-2*((H8 - AVGC20.8)+(H9 - AVGC20.9)+ABS((H8 - AVGC20.8)-(H9 - AVGC20.9)))))-(H10 - AVGC20.10)-(H11 - AVGC20.11)-ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12))-ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))-2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14)))-ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))-2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14))))-(H15 - AVGC20.15)-(H16 - AVGC20.16)-ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))+2*((H17 - AVGC20.17))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19))))-ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))+2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14)))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))+2*((H12 - AVGC20.12))+ABS((H10 - AVGC20.10)+(H11 - AVGC20.11)+ABS((H10 - AVGC20.10)-(H11 - AVGC20.11))-2*((H12 - AVGC20.12)))-2*((H13 - AVGC20.13)+(H14 - AVGC20.14)+ABS((H13 - AVGC20.13)-(H14 - AVGC20.14))))-(H15 - AVGC20.15)-(H16 - AVGC20.16)-ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))-ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))+2*((H17 - AVGC20.17))+ABS((H15 - AVGC20.15)+(H16 - AVGC20.16)+ABS((H15 - AVGC20.15)-(H16 - AVGC20.16))-2*((H17 - AVGC20.17)))-2*((H18 - AVGC20.18)+(H19 - AVGC20.19)+ABS((H18 - AVGC20.18)-(H19 - AVGC20.19)))))))/32
If you want to just add a - sign if the spread with the highest magnitude happens to be negative however, the resulting formula ends up being too long and slow to be practical or post in the forums.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 11/16/2004 Posts: 64
|
In your example how do you add the Donchain Channel to the code or am I missing some concept here? I can add the indicator to the chart, but do not see how to extract the code.
Or are somehow create scan from the Donchain chart displayed?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Donchian Channel is an indicator and has nothing to do with the code. You would select Add Indicator, choose Donchian Channel from the list and then choose the Custom PCF Indicator with the short formula in it as the parent of the Donchian Channel when prompted.
Adding and Moving Indicators
-Bruce Personal Criteria Formulas TC2000 Support Articles
|