Hi,
Here is something you can simplify to get what you want.
Best regards
|// RSIc trendlines w fct
// Original : Dimitri Tsokakis
// mod by Reinsley
*procedure* RSIc( n )
{
*C* = RSIa( *C*, n );
*O* = RSIa( *O*, n );
*H* = RSIa( *H*, n );
*H* = IIf( *H* < Max( *C*, *O* ), Max( *C*, *O* ), *H* );
*L* = RSIa( *L*, n );
*L* = IIf( *L* > Min( *C*, *O* ), Min( *C*, *O* ), *L* );
}
n = Param( "n", 9, 2, 30, 1 );//RSI sensitivity
RSIc( n );
Plot( *C*, "RSIc(" + n + ")", 1, 64 );
RSIlevHi = Param( "RSIlevHi ", 70, 2, 100, 1 );
RSIlevLo = Param( "RSIlevLo ", 30, 2, 100, 1 );
SetChartOptions( 0, 0, ChartGrid30 | ChartGrid70);
PlotOHLC( *O*, *H*, 50, *C*, "", IIf( *C* > 50, *colorPink*,
*colorPaleGreen* ), *styleCloud* | *styleClipMinMax* | *styleNoLabel*,
RSIlevLo , RSIlevHi );
PlotOHLC( *O*, 50, *L*, *C*, "", IIf( *C* < 50, *colorPaleGreen*,
*colorPink* ), *styleCloud* | *styleClipMinMax* | *styleNoLabel*,
RSIlevLo , RSIlevHi );
Plot(50,"",*colorBrown*, *styleLine* |*styleDashed*|*styleNoLabel*);
//PlotGrid(50);
// fast S&R RSIc
perfast = Param( "perfast", 10, 3, 100, 1 );//trendlines sensitivity
VertShiftFast = Param( "vs+", 4, 1, 20, 1 );// vertical shift "+"
// medium S&R RSIc
permed = Param( "permed", 40, 3, 100, 1 );//trendlines sensitivity
VertShiftMed = Param( "vso", 7, 1, 20, 1 );// vertical shift "0"
// Slow S&R RSIc
perslow = Param( "perslow", 50, 3, 100, 1 );//trendlines sensitivity
VertShiftslow = Param( "vst", 11, 1, 20, 1 );// vertical shift "T"
*procedure* SupRes( per, Vs, symb, Colorline )
{
x = Cum( 1 );
s1 = *L*;
s11 = *H*;
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 ), "", Colorline, 1 );
PlotText( symb, endt - 1 , endS - Vs , Colorline );// last point 1
support //green
PlotText( symb, startt - 1 , startS - Vs , Colorline );// first point 2
support
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 ), "", Colorline, 1 );
PlotText( symb, endt1 - 1 , endR + Vs - 2, Colorline );// last point 1
resistance // red
PlotText( symb, startt1 - 1 , startR + Vs - 2 , Colorline );// first
point 2 resistance
}
SRfast = SupRes( perfast, VertShiftFast, "+", *colorYellow* );
SRmed = SupRes( permed, VertShiftMed, "o", *colorAqua* );
SRslow = SupRes( perslow, VertShiftslow, "T", *colorWhite* );
// newday bar
NewdayBar = ParamToggle( "NewdayBar ", "No|Yes", 1 );
*if* ( NewdayBar )
{
segments = IIf( Interval() < *inDaily*, Day(), Month() );
segments = segments != Ref( segments , -1 );
Plot( segments, "", *colorDarkBlue*, *styleHistogram* | *styleOwnScale*
| *styleDashed* | *styleNoLabel* );
}
*Title* = "{{VALUES}}" + "\\c07 " + " (" + perfast + ")" + "\\c36 " + "
(" + permed + ")" + "\\c55 " + " (" + perslow + ")";
*GraphXSpace* = Param( "GraphXSpace", 5, 0, 30, 0.5 );|
Le 07/09/2010 08:47, afzal hossain a écrit :
[Attachment(s) <#TopText> from afzal hossain included below]
Friends
Could you please guys help me to draw line between higher high and
lower low value of RSI?
Please find the attach as example.
Regards
Afzal