hi,

I don't see why you need this complicated code. Code below gives same result 
(arrows included), rgds, Ed

// E.M.Pottasch 09/06/10 
SetBarsRequired(sbrAll,sbrAll); 
nbar = Param("nbar",4,2,50,1); 

PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) < H; 
PHighPrice = ValueWhen(PHigh,H); 
PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L; 
PLowPrice = ValueWhen(PLow,L); 

GraphXSpace = 5; 
SetChartOptions(0, chartShowDates); 
Plot(C,"\nLast",colorWhite,styleCandle); 
PlotShapes(shapeSmallCircle*PLow,colorGreen,0,L,-10); 
PlotShapes(shapeSmallCircle*PHigh,colorRed,0,H,10); 
PlotShapes(shapeUpArrow*PLow,colorGreen,0,L,-25); 
PlotShapes(shapeDownArrow*PHigh,colorRed,0,H,-25); 




From: Mubashar Virk 
Sent: Monday, September 06, 2010 8:44 AM
To: [email protected] 
Subject: [amibroker] Plotting Arrows on "Prices of Pivot Chart"


  
HI Reinsley,

I have tried to mark PH& PL with arrows instead of "stars" in the below
AFL of yours. I tried various combination of plotshape but failed in
every instance. Can you please help?

Thanks,
Mav

----------------------------------------------------------
// pivots and prices
// based on Pramod's comments http://www.amibroker.com/library/detail.php?id=617
// adapted by Reinsley : Prices on Pivot and ajustable digits #
// mod by Sanjiv Bansal : take care of Highs or Lows when two adjacent bars are 
equal
// does not reference to future

SetChartOptions( 0, chartShowDates );

_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();

_SECTION_BEGIN( "pivot" );
price = ParamToggle( "Plot Price", "Off|On", 1 );
num = Param( "trend", 4, 1, 10, 1 );
dist = 0.5 * ATR( 10 );
rightfig = Param( "rightfig ", 7, 1, 10, 1 );
xspace = Param( "GraphXSpace ", 10, 1, 20, 1 );

mHHV = HHV( H, num );
mLLV = LLV( L, num );

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] )
{
ml++;
}

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

i--;
}

if ( ml == num AND L[B] == mLLV[B] )
{
PlotText( "\n *\n", b, L[b], colorGreen );

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

if ( mu == num AND H[B] == mHHV[B] )
{
PlotText( " *\n", b, H[b], colorRed );

if ( price == 1 )
{
p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
PlotText( p , b - 2 , H[b] + dist[b] + 1, colorRed );
}
}
}
_SECTION_END();



Reply via email to