How to write Elder's 6% rules for backtest procedure


How to write rules for elder 6% equity loss in afl for backtest procedure?
If from begining of the new month the highest equity drop 6%, all trades must be close for the rest of the month. We are allowed to open position again on the next month

can someone please kindly point out where to look in the amibroker knowledge base or paste the code?

I am sure somebody already write the code and its so easy to do it in amibroker, but still I cant find it....


Hello @sikatgigi

Have you looked in the Amibroker Members’ Zone —> AFL Library?

I don’t know if the Elder’s 6% is there specifically, but there are a number of Elder’s ideas that members have shared there.


helo @nomad,

thanks for the reply, I just doble checked there, but I cant find it....

That is odd. When I signed in earlier today and did a sesrch in the formula list for Elder; a number of hits came up.

ahh yes, there is some Elder's formula in there, but there is no rules for Elder's 6%.

If you can find it, please kindly tell me the link I will go in to check it

From original response

@sikatgigi I suspect the best way to achieve this

is by using the custom backtest interface (referred to as a CBT). You need to calculate your current month's drawdown and when it reaches your threshold (6% in your example) then Exit existing trades and block any new Entries.

I have not seen an existing code like this so you will need to code it. I'm sure members of the forum will be interested in your code if you do.

Best wishes.

1 Like

@portfoliobuilder, yesss, that's it.... too bad I don't have coding skills, that is why I am asking in this forum....and like you said I also have not seen anyone coding this....

too bad....