How to write the trade prices on the chart

Hi,
I am trying to write the prices of the trades on the chart. After creating the Buy and Sell rules wit h the buyprice and sell price, I am adding the following lines, but the prices doesn't appear on the chart. Can you please tell me how can I add the trade prices on the chart?

dist = 1.5*ATR(10);

for( i = 0; i <BarCount; i++ )
{
if( Buy[i] )

PlotText( "Buy 1\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen ); 

if( Sell[i] )

PlotText( "Sell 2\n@" + C[ i ], i, L[ i ]-dist[i], colorRed ); 

}

Thank you.

Hard to tell but based on my experience, you may be plotting the text outside the chart canvas area.
Simplify to test your code: Try:

PlotText( "Buy 1\n@" + C[ i ], i, L[ i ], colorGreen );