Also i have a simple trend following system, but i m not able to code take profit clearly, after take profit arrow i have to wait for sell signal then only new buy signal generates
@Tomasz has put a lot of effort into creating comprehensive documentation, tutorials, and other materials to help users. You should try reading it sometime! Start here: https://www.amibroker.com/guide/afl/hold.html
Well, you didn't show us all of your code (for example, how is buyLimitPrice set?), and you don't say why the back testing results are not what you expect, so it will be very difficult for anyone here to help you solve your problem. You should also consider adding an Exploration to your code so that you can see the values of any important variables that you're using.