Hold() meaning and profit taking

what does hold(buy,2)mean here

Buy = Ref(buySignal, -1);
Buy = Hold(Buy,2) AND (Low < buyLimitPrice);   //Buy = Buy AND (Low < buyLimitPrice);
BuyPrice = Min(Open, buyLimitPrice);  

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

2 Likes

i know the vlaue will be true for period of 2 but its generating wrong result in backtesting

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.

thank you mradtke, i appreciate your response next time i will be more precise while asking question .