AutoTrendline(TargetArray, ID, Threshold, MinDistance, BarsBack, NoTouches, AllowSmallBreaks, NoBreakAllowed, SearchPeriods)
TargetArray - This is the array that will be used for finding a trendline.
ID - This function sets some variables in Amibroker and uses the string in ID as a prefix for the variable names. For example if ID is set to 'id1', one of the
variables set by the function will be 'id1_trendlineTouchesCount'
Threshold - This is a percentage value from the trendline to the price that should be considered a trendline touch.
MinDistance - This is the minimum number of required bars between trendline touches.
BarsBack - How far back do you want to find the trendline? If a trendline touch was found 5 days and this value was set to 5 then this trendline will be included in the search results.
NoTouches - The number of touches between the trendline and price for this trendline to be included in the search results.
AllowSmallBreaks - Allow the price to go below the trendline by a certain percent indicated by threshold.
NoBreaksAllowed - Specifies how many times the price can go below the trendline and still be considered valid.
SearchPeriods - The number of bars to use to search for a trendline.
The list of variables exported by this function are as follows (Note that the prefix for these variables will be different depending on what you set ID to):
_trendlineTouchesCount - The number of touches detected for the trendline. If no trendline was detected this value will be 0.
_startX, _startX, _finishX, _finishY - Trendline Coordinates