How to plot trailing stop, was: ApplyStop() function

Is there a way to access the trailing stop calculated by ApplyStop()?

I would lime to plot this value

Value = Applystop() would be nice.

@ara1 - you are old timer. You are using AmiBroker for many years. It would really be nice if you checked Knowledge Base first. If you just typed “trailing” in the search field of Knowledge Base you would get lots of interesting information, including this:

http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/

It is really easy. Google or KB search should your first step, before involving other people.

And no, ApplyStop can’t return value because ApplyStop is NOT a function, it does not do any calculation and does not produce any output.

ApplyStop is merely instruction to the backtester (like turning checkboxes in the settings) and stops are calculated and applied during trading simulation, which happens much later AFTER formula execution finished.

3 Likes

Hi Tomasz,
I have one query from above post.
That is , the above applystop function is for only Buy condition . what to do for Sell Scenario ?

Thanks in advance…

ApplyStop works for both long and short trades (if you have short rules defined too).

1 Like

Hi Tomaz. . Thank you for your precious reply. Will u share any link that is coded for short rule ??

@Elango for Short Selling, There are examples in some of these articles in the Knowledge Base,

http://www.amibroker.com/kb/2014/10/17/using-price-levels-with-applystop-function/

http://www.amibroker.com/kb/2016/01/20/number-of-stopped-out-trades-as-a-custom-metric/

And review the function instructions in the User Guide, Scroll down and look at examples and in user library for other possible examples

https://www.amibroker.com/guide/afl/applystop.html

2 Likes