Anyone there to correct this afl pls

jsb2012

Active Member
#1
_SECTION_BEGIN("Tom DeMark Trend Lines");
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
THIS SECTION DRAWS TD TREND LINES */

percent = 0.01 * 1; /* Adjust this percent as necessary, I use .01 because FOREX is a 0.0000 number */
firstpointL = 2;
firstpointH = 2;

y0=LastValue(Trough(L,percent,firstpointL));
y1=LastValue(Trough(Ref(L,-1),percent,1));

for( i = 1; i < BarCount AND y0 >= y1; i++ )
{

firstpointL++;
y0=LastValue(Trough(L,percent,firstpointL));
}

x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL));
x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1));
LineL = LineArray( x0, y0, x1, y1, 1 );
/*
Plot(C, "C", colorBlack, styleCandle);
*/
Plot( LineL, " Support Trend line", colorWhite,4 +8 );


yt0=LastValue(Peak(H,percent,firstpointH));
yt1=LastValue(Peak(Ref(H,-1),percent,1));

for(i = 1; i < BarCount AND yt0 <= yt1; i++ )
{

firstpointH++;
yt0=LastValue(Peak(H,percent,firstpointH));
}
xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH));
xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1));
LineH = LineArray( xt0, yt0, xt1, yt1, 1 );

Plot( LineH, "Resistance Trend line", colorBrown,4 + 8 );

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
_SECTION_END();
 

johnnypareek

Well-Known Member
#2
at your service sir. U can use parameter to adjust % change. :)

HTML:
_SECTION_BEGIN("Tom DeMark Trend Lines");
/*+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
THIS SECTION DRAWS TD TREND LINES */
_SECTION_BEGIN("Price");

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

_SECTION_END();
per=Param("Periods", 0.05, 0.01, 2, 0.01 );

percent = per * 1; /* Adjust this percent as necessary, I use .01 because FOREX is a 0.0000 number */
firstpointL = 2;
firstpointH = 2;

y0=LastValue(Trough(L,percent,firstpointL));
y1=LastValue(Trough(Ref(L,-1),percent,1));

for( i = 1; i < BarCount AND y0 >= y1; i++ )
{

firstpointL++;
y0=LastValue(Trough(L,percent,firstpointL));
}

x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL));
x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1));
LineL = LineArray( x0, y0, x1, y1, 1 );
/*
Plot(C, "C", colorBlack, styleCandle);
*/
Plot( LineL, " Support Trend line", colorRed,4 +8 );


yt0=LastValue(Peak(H,percent,firstpointH));
yt1=LastValue(Peak(Ref(H,-1),percent,1));

for(i = 1; i < BarCount AND yt0 <= yt1; i++ )
{

firstpointH++;
yt0=LastValue(Peak(H,percent,firstpointH));
}
xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH));
xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1));
LineH = LineArray( xt0, yt0, xt1, yt1, 1 );

Plot( LineH, "Resistance Trend line", colorBrown,4 + 8 );

/*+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++*/
_SECTION_END();
johnnypareek@yahoo. com
 

Similar threads