Try changing the default value of vertshift to 2 and use...
    if ( mu == num )
    {
        PlotText( ""+H[b]+"\n***" , b, H[b]+ vertshift, colorRed );
/*
        PlotText( "***\n" , b, H[b], colorRed );
        p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
        PlotText( p , b - 2, H[b] + vertshift , colorRed );
*/
    }


 Best Regards
Rick Osborn




________________________________
From: reinsley <[email protected]>
To: [email protected]
Sent: Sat, October 10, 2009 9:18:58 AM
Subject: Re: [amibroker] Plottext the pivot's price

  

Thank you Panos,

Your solution place the stars inside the candle.
I give up to find a solution with \n.

I keep the following formula that is acceptable. Version with one star 
and an auto adjust space.

Best Regards

// Plot line on pivot and price
// does not reference to future
// add the pivot price

_SECTION_BEGIN( "Price" );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} \nOp %g, \nHi 
%g, \nLo %g, \nCl %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( 
ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor( "Color", colorBlack ), styleNoTitle | 
styleCandle  | styleThick );
_SECTION_END( );

num = Param( "trend", 4, 1, 6, 1 );
rightfig = Param( "rightfig ", 7, 1, 10, 1 );
dist = 0.5 * ATR( 10 );

FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );

for ( b = Firstvisiblebar + num; b <= Lastvisiblebar AND b < BarCount - 
num; b++ )
{
i = num;
ml = 0;
mu = 0;

while ( i > 0 )
{
if ( L[b] <= L[b-i] && L[b] <= L[b+i] )
{
ml++;
}

if ( H[b] >= H[b-i] && H[b] >= H[b+i] )
{
mu++;
}

i--;
}

if ( ml == num )
{
PlotText( "\n *", b, L[b], colorGreen );
p = StrRight( NumToStr( L[b], 4.1 ), rightfig );
PlotText( "\n\n" + p, b-2 , L[b] , colorGreen );
}

if ( mu == num )
{
PlotText( " *" , b, H[b], colorRed );
p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
PlotText( p , b-2 , H[b] + dist[b], colorRed );
}
}

GraphXSpace = 25;

Panos Boufardeas a écrit :
> 
> 
> Hi
> try this way
> 
> if ( mu == num )
> {
> PlotText( ""+H[b]+"\n* ***" , b, H[b], colorRed );
> //p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
> //PlotText( p , b - 2, H[b] + vertshift , colorRed );
> }
> 
> Panos
> 
> At 15:58 09-10-2009 09-10-2009, you wrote:
>  >
>  >
>  >Hi,
>  >
>  >This little mod plots the pivot's price.
>  >
>  >The low pivot's price is displayed two carriage return under the ***
>  >This solution is nice as the vertical shift does not vary up to the
>  >pane's number or pane's size.
>  >
>  >I can't find the syntax to plottext the prices above the high pivot. The
>  >only way I found is to add vertshift param. The caveat is the good value
>  >is linked to the size's pane.
>  >
>  >Do you see a solution using \n at the right place concerning high price
>  >value ?
>  >Something like an anti \n...
>  >
>  >TIA
>  >
>  >Best regards
>  >
>  >// Plot line on pivot and price
>  >// does not reference to future
>  >// add the pivot price
>  >
>  >_SECTION_BEGIN( "Price" );
>  >_N(Title = StrFormat("{ {NAME}} - {{INTERVAL}} {{DATE}} \nOp %g, \nHi %g,
>  >\nLo %g, \nCl %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC(
>  >C, 1 ) ) ));
>  >Plot( C, "Close", ParamColor( "Color", colorBlack ), styleNoTitle |
>  >styleCandle | styleThick );
>  >_SECTION_END( );
>  >
>  >num = Param( "trend", 4, 1, 6, 1 );
>  >vertshift = Param( "vertshift ", 80, 1, 200, 1 );
>  >rightfig = Param( "rightfig ", 7, 1, 10, 1 );
>  >
>  >FirstVisibleBar = Status( "FirstVisibleBar" );
>  >Lastvisiblebar = Status( "LastVisibleBar" );
>  >
>  >for ( b = Firstvisiblebar + num; b <= Lastvisiblebar AND b < BarCount -
>  >num; b++ )
>  >{
>  >i = num;
>  >ml = 0;
>  >mu = 0;
>  >
>  >while ( i > 0 )
>  >{
>  >if ( L[b] <= L[b-i] && L[b] <= L[b+i] )
>  >{
>  >ml++;
>  >}
>  >
>  >if ( H[b] >= H[b-i] && H[b] >= H[b+i] )
>  >{
>  >mu++;
>  >}
>  >
>  >i--;
>  >}
>  >
>  >if ( ml == num )
>  >{
>  >PlotText( "\n***", b, L[b], colorGreen );
>  >p = StrRight( NumToStr( L[b], 4.1 ), rightfig );
>  >PlotText( "\n\n" + p, b - 2, L[b] , colorGreen );// L[b] -
>  >vertshift
>  >}
>  >
>  >if ( mu == num )
>  >{
>  >PlotText( "***\n" , b, H[b], colorRed );
>  >p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
>  >PlotText( p , b - 2, H[b] + vertshift , colorRed );
>  >}
>  >}
>  >
>  >GraphXSpace = 25;
>  >
>  >
> 
> 


   

Reply via email to