any help

#11
your code in post #1 is just awful.

It is much simpler.
You just have to loop visible chart area and compare peak and through with rsi variable. That's it.

So here is correction.

Code:
_section_begin( "rsi styleclipminmax" );
// modified by trash
version( 5.90 );

periods = param( "periods", 12, 1, 200, 1 );
maxclip = param( "maxclip", 80, 1, 100, 1 );
minclip = param( "minclip", 20, 1, 100, 1 );

r = rsia( c, periods );

graphxspace = 8;
setchartoptions( 1, chartshowdates, 0, 0, 0, 0 );
plot( r, "rsi",
      paramcolor( "color", colorcycle ),
      paramstyle( "style" ),
      null, null, 0, 0, width = -20 );
//
plotohlc( r, r, 50, r, "",
          iif( r > 50, colorred, colorbrightgreen ),
          stylecloud | stylenolabel | styleclipminmax,
          minclip, maxclip );
//
plotgrid( overbought = 80, colorred, 1, 2, true );
plotgrid( oversold = 20, colorgreen, 1, 2, true );
plotgrid( center = 50, colorblack, 3, 2, true );

_n( title = strformat( "{{name}} - {{interval}} - {{date}}  {{values}}" ) );
_section_end();

_section_begin("show values at h&&l");
// by  trash
version( 5.90 );

change = param( "%change", 5, 1, 100, 0.1 );

pk = peak( r, change, 1 );
th = trough( r, change, 1 ); 

offset = param( "y-offset", 10, 0, 50, 1 );
if ( paramtoggle( "display text", "off|on", 1 ) ) {
    font = "arial";
    fontsize = 8;

    bi = barindex();
    start = firstvisiblevalue( bi );
    end = lastvisiblevalue( bi );
    for ( i = start; i <= end; i++ ) {
        if ( r[i] == pk[i] )
            plottextsetfont( strformat( "%1.1f", pk[ i ] ),
                             font, fontsize,
                             i, pk[ i ],
                             colorgreen, colordefault, offset );
        //
        if ( r[i] == th[i] )
            plottextsetfont( strformat( "%1.1f", th[ i ] ),
                             font, fontsize,
                             i, th[ i ],
                             colorred, colordefault, -(offset+fontsize) );
    }
}
_section_end();
so it will look properly then.

thanks mr.trash
but i need (the close price no.) on pk. And th. Of rsi
if u can help me with it
 
#13
Your code in post #1 is just awful.

It is much simpler.
You just have to loop visible chart area and compare peak and through with RSI variable. That's it.

So here is correction.

Code:
_SECTION_BEGIN( "RSI styleClipMinMax" );
// modified by trash
Version( 5.90 );

periods = Param( "Periods", 12, 1, 200, 1 );
maxClip = Param( "maxClip", 80, 1, 100, 1 );
minClip = Param( "minClip", 20, 1, 100, 1 );

r = RSIa( C, periods );

GraphXSpace = 8;
SetChartOptions( 1, chartShowDates, 0, 0, 0, 0 );
Plot( r, "RSI",
      ParamColor( "Color", colorCycle ),
      ParamStyle( "Style" ),
      Null, Null, 0, 0, width = -20 );
//
PlotOHLC( r, r, 50, r, "",
          IIf( r > 50, colorRed, colorBrightGreen ),
          styleCloud | styleNoLabel | styleClipMinMax,
          minClip, maxClip );
//
PlotGrid( Overbought = 80, colorRed, 1, 2, True );
PlotGrid( Oversold = 20, colorGreen, 1, 2, True );
PlotGrid( Center = 50, colorBlack, 3, 2, True );

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}}  {{VALUES}}" ) );
_SECTION_END();

_SECTION_BEGIN("Show Values at H&&L");
// by  trash
Version( 5.90 );

change = Param( "%Change", 5, 1, 100, 0.1 );

pk = Peak( r, change, 1 );
th = Trough( r, change, 1 ); 

offset = Param( "Y-offset", 10, 0, 50, 1 );
if ( ParamToggle( "Display Text", "OFF|ON", 1 ) ) {
    font = "Arial";
    fontsize = 8;

    bi = BarIndex();
    start = FirstVisibleValue( bi );
    end = LastVisibleValue( bi );
    for ( i = start; i <= end; i++ ) {
        if ( r[i] == pk[i] )
            PlotTextSetFont( StrFormat( "%1.1f", pk[ i ] ),
                             font, fontsize,
                             i, pk[ i ],
                             colorGreen, colorDefault, offset );
        //
        if ( r[i] == th[i] )
            PlotTextSetFont( StrFormat( "%1.1f", th[ i ] ),
                             font, fontsize,
                             i, th[ i ],
                             colorRed, colorDefault, -(offset+fontsize) );
    }
}
_SECTION_END();
So it will look properly then.



dear Trash ,

i m unable to plot the above code as it is giving lots of errors in amibroker

Kindly help
 
#15
It is for AB version 5.90 as at least one error message will clearly tell you! So you will have to adjust to lower version number yourself.
i tried to put the price (pk & th) at macd (pk & th) but it give an error,,,, i think because most lows at macd is under Zero >>>plz can u corect it
 

Similar threads