[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Plottext the pivot's price



PureBytes Links

Trading Reference Links

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;
>  >
>  >
> 
> 



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/