I use below code
![priceatbuy=0;
for( i = 0; i < BarCount; i++ )
{
if( priceatbuy == 0 && Buy\[ i \] )
priceatbuy = BuyPrice\[ i \];
PlotText("P" + priceatbuy, SelectedValue(BarIndex()), L\[SelectedValue(BarIndex())\] - ist\[SelectedValue(BarIndex())\], colorWhite);
if( priceatbuy > 0 && SellPrice\[ i \] < (priceatbuy - (0.027 * priceatbuy/100)) )
{
Sell\[ i \] = 1;
SellPrice\[ i \] = (priceatbuy - (0.027 * priceatbuy/100)) ;
plotShapes(shapeDownArrow*sell, colorpink );
priceatbuy = 0;
}
else
Sell\[ i \] = 0;
}][1]
With above plotText, when i print the variable "priceatBuy", i see the text is overlapped and I am not able to see the value correctly. Is it because that SellPrice[i] and BuyPrice[i] returning some other value that Plottext doesnt understand? If I print Sell[i] or Buy[i], it prints correctly. May I know how to get this value correctly.
PFA image
Your code is wrong.
Below is a correct code sample (The loop contains SL exit only! So you need to add some profit exit condition too otherwise you always exit at loss.)