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:

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.


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,

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