Price based trailing stoploss code

Does anybody have the price based trailing stoploss / trailing take profit code to help me in completing the below for me:

buy= my statergy;
sell= price based trailing stoploss / trailing take profit code ;
short= my statergy;
cover= price based trailing stoploss / trailing take profit code ;

please help / guide

@santy, surely by now you realize that if you put no effort into solving your own problem, others are not likely to spend their valuable time trying to solve it for you. The best place to start with any stop or profit target is with the built-in ApplyStop() function: https://www.amibroker.com/guide/afl/applystop.html. Give that a try, and as always, post your code and tell us what roadblocks you encounter.

If that doesn't do what you want, then you can explore other options.

2 Likes

@santy I fully agree with @mradtke.

The only way to learn is to make an effort to write your own code and modifying it until it does what you want to achieve.

You can start also studying some KB articles, like this one tilted: Using price levels with ApplyStop function.

Look at that code, try to fully understand it referring to the documentation that Matt indicated to you, and then start to change it to add a "take profit" stop (stopTypeProfit),
When it works as expected, then try to replace the stop mode logic used in the example with the stopTypeTrailing type (providing the desired percent values), and so on.

1 Like