Amibroker Back testing Help

#1
Experts Please respond,

How to do Backtesting an existing afl chart with some additions in backtesting.

suppose we take nakshatra afl chart, in it the line increases as the price bars are going up and this chart having buy sell indicators. if we perform backtest as it is the report shows -3470 result in ending capital with initial 100000 capital. means loss more than cap.

so we have to make some additions in backtesting like adding the Tsl as increasing line and also fixed stoploss at buy price minus 5 points to avoid big losses wherever necessary.
(in some afls 2 buy signals come continuously there we have to take fixed stoploss and once again buy at second buy signal for this there should be some parameters to comeout)

also some points randomly to add where ever necessary in backtesting.
even buy signal come backtest should buy only when certain one or more conditions met like price also should cross up some moving average etc,.
instead of it sell when afl given sell signal only, each time it has to sell half of it at 25 points profit and rest at afl sell signal.

So These types of backtests with modifications or additions we have to do.
How to do such backtests with our additions to existing afl, please advice procedure ways to make it better.
 
#2
can't we do backtesting with our own conditions than what is exactly in afl.
it takes only what is written in afl as buy and sell conditions.
how can the backtesting be done with different parameters and entry exit changes in parameters.
 
#3
also is there any intraday backtesting afl for amibroker which can calculate each day profit loss by closing trades within or at the end of day.
 

sudris

Well-Known Member
#4
can't we do backtesting with our own conditions than what is exactly in afl.
it takes only what is written in afl as buy and sell conditions.
how can the backtesting be done with different parameters and entry exit changes in parameters.
if it takes only what is written, why not try to write your conditions/parameters in afl?

also is there any intraday backtesting afl for amibroker which can calculate each day profit loss by closing trades within or at the end of day.
it all depends on your buy/sell & short/cover conditions.
 
#5
thanks sudris for your suggesting answers,
the problem is as per now I cannot able to write afl codes , I need help very much in this area where I am a new city not knowing any path ways. any way your words are good one.

in another way if any having already few backtesting afls then it will do for me, few minor changes will be later thing.
 

sudris

Well-Known Member
#6
you can try reading this guide. it is explained with simple language for better understanding.
below is the link.

http://www.amibroker.com/guide/h_backtest.html

In brief,
Amibroker has four variables to handle trades.
2 Variables for Long Trades ("Buy" to open/enter Long & "Sell" to close/exit the Long)
2 Variables for Short Trades ("Short" to open/enter Short & "Cover" to close/exit Short)

these four variables accept your condition rules and hold as "True/False" whenever the condition given is met or not respectively.

lets say we have the rules for entry and exit of long trades as below:
Long entry rule = when close>previous close
Long exit rule = when close<previous close

in terms of afl it translates as below

Code:
Buy = C>Ref(C,-1) ; 
Sell = C<Ref(C,-1);
I've used a function called "Ref()" in both the statements. you can find what this function does from the help menu/manual.

hope this helps
 

Similar threads