May 8, 2014

Scanner mode in Amibroker

Amibroker has a scanner utility where you can define buy, sell, short, cover strategies.

This is a simple test strategy to demonstrate how simple it is easy to code. Note that I just made up this example so do not jump in and trade blindly.

Buy - when stock closes above 20 dma
Sell - when stock closes below 5 dma but is already bullish
Short - when stock closes below 20 dma
Cover - when stock closes above 5 dma but is already bearish

This is the code...


The additional conditions for Sell (Cover) are required to ensure we have a trailing SL only for long (short) positions.

Note that we are not defining any columns to be outputted. This is possible only in explorer.

And this is the result. Note that you cannot get any other format.


I will cover different types of trailing SL in a later post.

No comments:

Post a Comment

Share this...