Stops priority in the default backtest procedure in AmiBroker
The order stops are triggered in the backtest is the following:
– Fixed Ruin stop (loosing 99.96% of the starting capital)
– Max. loss stop
– Profit target stop
– Trailing stop
– N-bar stop* (see below)
In versions 4.61 and higher: you can decide if N-BAR stop has the lowest or the highest priority. (more…)
Filed by AmiBroker Support at 6:48 am under Stops
Comments Off on Stops priority in the default backtest procedure in AmiBroker
September 1, 2006
How to change property for multiple symbols at once.
In order to automatically change a property for many symbols – instead of manual action in Symbol -> Information dialog one can use OLE automation.
For example – to unmark “Use only local database” option for all the symbols, it’s enough to run such SCAN:
– Analysis -> Formula Editor:
– enter:
AB = CreateObject("Broker.Application");
st = AB.Stocks(Name());
st.DataSource = 0;
Buy = 0
– Tools -> Send to Auto-analysis
– Apply to: All Symbols, N-last quotations = 1
– press SCAN
The other example shows how to rename all the symbols and replace .TO suffix with -TC (this may be useful when we want to use the existing historical data with a new datasource which uses a different symbology).
– Analysis -> Commentary
– enter:AB = CreateObject("Broker.Application");
sts = AB.Stocks();
Qty = sts.Count;
for( i = Qty - 1; i >= 0; i = i - 1 )
{
st = sts.Item( i );
Ticker = st.Ticker;
printf("changing " + ticker + "\n" );
Length = StrLen(Ticker );
if( StrFind(ticker, ".TO") )
st.Ticker = StrLeft( ticker, Length-3)+"-TC";
– press APPLY
– use: VIEW -> Refresh All to see the changes in the symbol tree.
CAVEAT: The commentary formula above iterates through ALL SYMBOLS in the database, therefore, if your database is big (has more than 100 symbols) it may be SLOW, and you may experience “not responding” message, but it is NORMAL. It does not mean that program has stopped working. It just means that it has not completed iteration yet. In that case just WAIT and don’t touch it.
Filed by AmiBroker Support at 10:03 am under Data
3 Comments
Price chart with independent style
If one wants to display a Candlesticks in one chart pane and Bars in another one, then it’s necessary to use a formula which does not read the settings from: View -> Price Chart Style.
The following custom Price formula allows to achieve this: (more…)
Filed by AmiBroker Support at 9:54 am under Indicators
Comments Off on Price chart with independent style