There's nothing like it on the forum,
and if you can code such an indicator, I believe it will alert the test, or
break out of all the best 'human like' trend lines. If you do it, so it works
in all of FXCM's markets, for the FX can you just count the 0.0001 as the
tick and ignore the 5th decimal. That way, it will work in FX, equity and
commodity. However for gold make $0.10 as the tick, so it is similar to
future market ticks.
________________________________________________________________
The following pseudo code details an improved Automatic Trend line (TL) called
(NewATL), the explanation is done with respect to a bullish TL tests for 'up'
TL's, but obviously the indicator will annotate and alert up and down TL's, plus
the corresponding parallel channel line. It's meant to be an improvement over
the original custom indicator posted here:
http://74.52.98.37/code/viewtopic.php?f ... 67&p=14577Summary: The logic is composed so the indicator adds TL's, updates them, or
then voids them in the most human way possible. It will therefore alert the touch
(test) of a TL, or the break out of a TL. This spec will therefore cover 7 main
functions to achieve this:
1. The NewATL settings,
2. The TL start position
3. The secondary steeper TL's
4. The TL void rules
5. The TL updates rules.
6. The trend channel line (TC).
7. The alert functions.
1. The TL settings:
- The 'Time Frame' setting will give 4 Booleans to annotate the ATL's for the main
time frames:
1. Show Weekly (YES/NO)
2. Show Daily (YES/NO)
3. Show Hourly (YES/NO)
4. Show m5 (YES/NO) for intra-day TL's.
These 4 main time frame define all the important market structure to which price
mostly interacts with. The same logic that defines the TL is used for all the time
frames.
- The NewATL will need the same 'style' settings as the 'Add Line' parameters
from marketscope 2.0. This is helpful because the different time frame TL's
can be given difference colors or widths.
- The ' Extended Length' setting is needed to extend ATL's into the future on the
chart [X] periods past the current price bar; this allows the trader to see where the
TL will get support tests.
- A ' penetration tolerance' setting is needed. The third test of the 'potential'
trend line is where most TL's hold or fail; the penetration tolerance lets the
equation of the TL get crossed by price [X] ticks below. If the penetration tolerance is not exceeded, then the original TL's angle which is based off the 2 original zigzag points is kept. This confirms the TL support held, then the TL will then alert at the 4th test of that original TL (see alert settings).
See the third test of the blue line in the dashed section
<http://tiny.cc/us30-5>
- The 'draw limit' can be an integer value that will limit the number of updated
TL's that can draw from an original start point. A default value of 4 can be used.
Once the TL is tested by price, the indicator logic needs to pause TL signals until price gets back above the TL. Once price is over the TL by an amount equal
to the penetration tolerance; the TL then becomes active again, and it will alert tests of the line equation when touched from above for up TL's.
If the penetration tolerance limit is exceeded, the original TL is 'greyed out' and left on the chart, and it no longer signal price test alerts. The greyed out trend line's
start and end points are saved to an multidimensional array, this is needed because it can be used to back test other signals against the TL tests if the LUA code is altered by another user. Price reversal signals like divergences tend to be found at TL support tests.
US30 daily chart, not the original TL from the two lows is left grey.
<http://tiny.cc/us30-2> file name 2015.03.06 2200 US30 DAILY - updated TL
No closes below the TL's 3rd test
<http://tiny.cc/us30-6>
2. The start point for up trend lines:
The beginning of a 'key' TL should start at the edge of the range, the best way to ensure the start point is:
A) The newATL will use the ZigZag indicator (zig for short) to define the price troughs; therefore an ATL will start from a Zigzag trough which will therefore be a price trough. That zig TL start point will also be a "lower low" to a prior zig trough.
B) The TL start point is a 'zig lower low', plus it will also have printed afterwards a 'zig higher high' immediately following the low. This inverted head and shoulders of Zig yields the start point.
The US30 weekly chart below shows a TL zig start point.
<http://tiny.cc/us30-1> file name 2015.03.06 2200 US30 weekly key low with 3 points.
The 'second TL point' which then establishes the angle of a possible TL is another zig/price trough that is higher than the start level. This 'potential' TL will remain valid until it receives a third touch (test).
If case price rallies aggressively and the 'potential' TL is not touched a third time (virgin TL), the indicator can also start scanning for steeper TL's with their start point becoming the second point of the 'potential' TL, or another zig inside but higher. All steeper trend lines will also use the same logic to define their start point.
3. The secondary steeper TL (inside virgin TL)
After a 'potential' TL is in place with two points, so long as it hasn't been tested, the indicator will also scan for steeper TL that has a less picky start point. These steeper TL's can start from the potential TL's 'second point', or they will find new ones with the zig inverted H&S pattern. The only condition needed is that the steeper TL's start point will be a higher price than the virgin TL's start point.
US30 weekly, the indicator annotates steep TL's inside potential 'virgin' TL's
<http://tiny.cc/us30-3>
file name : 2015.03.06 US30 weekly - STEEPER TL
4. The TL void rules.
- IF the penetration tolerance is exceeded (at bar close) at the 3rd test, THEN that 'potential' TL is greyed out, and left on the chart, but will not alert further. The same applies for all other tests of the TL, once the price closes below it great than the penetration tolerance, it is void.
5. The TL update rules
When a 'potential' TL fails at it's third test, if price continues to make a deeper pull back, once that messy third test prints a zig trough, a new TL can
update here as a second point. We now have a new virgin potential TL to watch so
long as it is an up TL.
IF this new second point fails again, the indicator can continue to draw potential TL's from the original start point, provided they are still 'up' TL's, or until the draw limit is exceeded for that original start point.
These two conditions take care of the messy tests when repainting the TL is needed. However, if the third test holds, then there is one house keeping
rule.
- 'pinching down' a TL. Once the fourth test has completed, and price
is back above the TL, IF the third test was messy, then the low of that
third test can be made the TL's second point; meaning the original TL
and be repainted less steep. This just gives the lowest possible up TL.
6. The trend channel line (TC).
Again with respect to only up TL's. Once an established TL has 3 tests in place,
the indicator will add a parallel TC line from the highest zig peak between the
start point and the 3rd lower test.
TC's can be voided when their topside penetration tolerance is violated, and if
this occurs, they could be updated to the widest peak.
A TC start from an established potential TL.
<http://tiny.cc/us30-7>
7. The TL alert functions.
These setting need four Booleans.
1. The '3rd test alert' ' YES/NO. If the bool is set to NO, the indicator will ignore the 3rd test and only alert at the 4th or more test of an 'established' trend line. The third test of any potential TL is the 'make or break' point; so it is less likely to hold than the 4th test. When the bool is set to YES, the indicator will include the 3rd test.
2. The 'Break out (BO) alert' (yes/no). TL break outs only occur after the third
test is in place, so when this bool is set to YES, the indicator will alert any time
a penetration tolerance fails at a TL's 4th or more test. This is a good signal because trading the failure of a trend can provide an edge.
3. The Trend Channel (TC) alert has two Booleans. As we know, once there is an 'established' TL with 3 tests in place, the indicator calculates the opposite parallel TC line from one point that gives it the angle.
3a. 'Alert TC test' (yes/no). When set to YES the indicator will alert the second and
all subsequent tests of a TC until the lower TL is void.
3b. 'Skip TC 2nd test' (YES/NO). When set to YES, the second test of a TC is
skipped and it only alert at the 3rd test of a TC.