Auto Trendlines

Status
Not open for further replies.
#1
Hello,
Does anyone know of an auto trendline AFL they really like? There are a couple in the AB library but they are not what I am looking for. Tradestation has an auto trendline indicator that is quite good I hear and so does Ensign. I tried the Ensign and it is excellent.
I would be very grateful if someone knew of such an AFL or would share it with me. Thank you for any and all help.

Kindest regards,

Tim
 

THE LORD

Active Member
#2
// Parallel lines defined by the automatic support and the HighestBetween point
x = Cum(1);per =1; s1=C;s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
endt= LastValue(ValueWhen( pS, x, 1 ));
startt=LastValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = LastValue(ValueWhen( pS, s1, 1 ) );
startS = LastValue( ValueWhen( pS, s1, 2 ));
aS = (endS-startS)/dtS;bS = endS;
trendlineS = aS * ( x -endt ) + bS;
Plot(IIf(x>startt-10,trendlineS,-1e10),"", colorLavender,4 +8 );
H1=LastValue(Highest((Cum(1)>startt AND Cum(1)<endt)*H));
tH1=LastValue(ValueWhen(H==H1,Cum(1)));
Color=IIf((Cum(1)==startt OR Cum(1)==endt),colorYellow,IIf(Cum(1)==tH1,colorOrange,colorBlack));

// Parallel lines defined by the automatic resistance and the LowestBetween point
x = Cum(1);per =1; s1=C; s11=C;
pR = PeakBars( s11, per, 1 ) == 0;
endt1= LastValue(ValueWhen( pR, x, 1 ));
startt1=LastValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = LastValue(ValueWhen( pR, s11, 1 ) );
startR = LastValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
Plot(IIf(x>startt1-10,trendlineR,-1e10),"",colorLavender,4 +8 );
L1=LastValue(Lowest(IIf(Cum(1)>startt1 AND Cum(1)<endt1,L,10^10)));
tL1=LastValue(ValueWhen(L==L1,Cum(1)));
Color=IIf((Cum(1)==startt1 OR Cum(1)==endt1),colorYellow,IIf(Cum(1)==tL1,colorOrange,colorBlack));
_SECTION_END();

I HAVE THIS TREND FROMULA PLEASE TRY IT
 

THE LORD

Active Member
#4
sorry mr-raven4ns this is what i have but i like what i see in the picture if get this indecator please dont forget me
best regardes to you
 

THE LORD

Active Member
#5
im not sure if this going to help or not



SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Trend Line");

function GetXSupport(lLow, Percentage, Back)
{
return ((BarCount - 1) - LastValue(TroughBars(lLow, Percentage,Back)));
}
function GetYSupport(lLow, Percentage, Back)
{
return (LastValue(Trough(lLow, Percentage, back)));
}

function GetXResistance(hHigh, Percentage, Back)
{
return ((BarCount - 1) -LastValue(PeakBars(hHigh, Percentage, Back)));
}
function GetYResistance(hHigh, Percentage, Back)
{
return (LastValue(Peak(hHigh, Percentage, Back)));
}
////////////////////////////////////////////////////////////////////////
//Parameters
Percentage = Param("Percentage", 0.01, 0.01, 100. ,0.01);
Back = Param("How many lines?", 1, 1, BarCount-2);
DrawR = ParamToggle("Draw Resistance", "No|Yes", 1);
DrawS = ParamToggle("Draw Support", "No|Yes", 1);
Extend = ParamToggle("Extend Lines?", "No|Yes", 1);
DrawAllLines = ParamToggle("Draw All Lines?", "No|Yes", 1);
Main = C;
lLow = L;
hHigh = H;
////////////////////////////////////////////////////////////////////////
//Plotting Area
Plot(Main, "", colorGreen, styleCandle);
if(DrawAllLines)
for(i = 2; i<=Back+1; i++)
{
if(DrawS){
x0 = GetXSupport(lLow, Percentage, i);
x1 = GetXSupport(lLow, Percentage, i-1);
y0 = GetYSupport(lLow, Percentage, i);
y1 = GetYSupport(lLow, Percentage, i-1);
x = LineArray(x0, y0, x1, y1, Extend);
Plot(x, "Support", colorYellow, styleLine|styleDots|styleThick);
}
if(DrawR){
x0 = GetXResistance(hHigh , Percentage, i);
x1 = GetXResistance(hHigh , Percentage, i-1);
y0 = GetYResistance(hHigh , Percentage, i);
y1 = GetYResistance(hHigh , Percentage, i-1);
x = LineArray(x0, y0, x1, y1, Extend);
Plot(x, "Resistance", colorBlue , styleLine|styleDots|styleThick);
}
}
else
{
if(DrawS){
x0 = GetXSupport(lLow, Percentage, Back+1);
x1 = GetXSupport(lLow, Percentage, Back);
y0 = GetYSupport(lLow, Percentage, Back+1);
y1 = GetYSupport(lLow, Percentage, Back);
x = LineArray(x0, y0, x1, y1, Extend);
Plot(x, "Support", colorYellow, styleLine|styleDots|styleThick);
}
if(DrawR){
x0 = GetXResistance(hHigh , Percentage, Back+1);
x1 = GetXResistance(hHigh , Percentage, Back);
y0 = GetYResistance(hHigh , Percentage, Back+1);
y1 = GetYResistance(hHigh , Percentage, Back);
x = LineArray(x0, y0, x1, y1, Extend);
Plot(x, "Resistance", colorBlue , styleLine|styleDots|styleThick);
}
}
 
#10
Here is an auto trendline code that is pretty good. The gentleman who produced the code said I might share it with anyone who wanted it. There have been a few people who asked me if i found such a code but I can't remember their names so i will post it here in hopes they will see it.

Tim
http://www.aussiestockforums.com/forums/showthread.php?t=1737
But forum authority says : `ASF no longer allows people to register with free web-based email addresses.' Would u upload the file somewhere else. please?
 
Status
Not open for further replies.

Similar threads