please code trends indicator for double lines of support and resistance

rvlv

Active Member
there is one indicator called sve trends.
the default code draws a suport or resistance line.
default settingsare multiplier 2.8 and atr period 10
but it is observed that by using multiplier 4 and atr periods 21,in metatrader4,the results are better.

our new code uses two lines of support and resistance
one trends line uses 2.8 and 10
second line uses 4 and 21
can somebofy help get this new code please
=================================================
the code for single trend line is as follows
=====================================
SetBarsRequired(-2,-2); //Turn Quick AFL Off
SetChartOptions(0,chartShowArrows|chartShowDates);

//LISTING 1 DEFAULTMAIN
// SVE TRENDS Trial stop function
//DEFAULT 2.8 AND 10
// MULTIPLIER 4 ATR 21 BEST INDICATOR BY JASPER WINKLER
ATRfact = Param( "ATR multiplication", 2.8, 1, 10, 0.1 );
period = Param( "ATR Period", 10, 1, 100 );

HiLo = IIf( (H-L) < 1.5 * MA( H-L, period ), H-L, 1.5 * MA( H-L, period ) );

Href = IIf( L <= Ref( H, -1 ), H - Ref( C, -1 ), ( H - Ref( C, -1 ) ) - ( L - Ref( H, -1 ) ) / 2 );
Lref = IIf( H >= Ref( L, -1 ), Ref( C, -1 ) - L, ( Ref( C, -1 ) - L ) - ( Ref( L, -1 ) - H ) / 2 );
diff1 = Max( HiLo, Href );
diff2 = Max( diff1, Lref );
ATRmod = Wilders( diff2, period );

loss = atrfact * ATRmod;
resistance = C + loss;

support = L;
trends = H;

for( i = 4; i < BarCount; i++ )
{
if( L[ i ] >= L[ i-2 ] AND
L[ i-1 ] >= L[ i-2 ] AND
L[ i-3 ] >= L[ i-2 ] AND
L[ i-4 ] >= L[ i-2 ] )
{
support[ i ] = L[ i - 2];
}
else
if( L[ i ] > H[ i-1 ] * 1.0013 )
{
support[ i ] = H[ i-1 ] * 0.9945;
}
else
if( L[ i ] > support[ i-1 ] * 1.1 )
{
support[ i ] = support[ i-1 ] * 1.05;
}
else
{
support[ i ] = support[ i-1 ];
}

if( H[ i ] > trends[ i-1 ] AND
H[ i-1 ] > trends[ i-1 ] )
{
trends[ i ] = Max( trends[ i-1 ], support[ i ] );
}
else
if( H[ i ] < trends[ i-1 ] AND
H[ i-1 ] < trends[ i-1 ] )
{
trends[ i ] = Min( trends[ i-1 ], resistance[ i ] );
}
else
if( H[ i ] >= trends[ i-1 ] )
trends[ i ] = support[ i ];
else
trends[ i ] = resistance[ i ];

}
Colortrends =IIf(Close>trends,colorBrightGreen,colorred);
Plot( trends, "Trends", colorTRENDS,STYLETHICK );

//Plot( C, "Price", colorBlack, styleBar );
Colorpetd = IIf(RSI(8)>50,colorAqua,colorRed);
Plot( C, "Close", COLORPETD, styleBar, Null, Null, 0, 1, 3 );//5% THICKNESS
Buy = Cross( C, trends );
Sell = Cross( trends, H );