Australian (ASX) Stock Market Forum

Amibroker FAQ

This one has me stumped...

On my futures contracts, how do i get rid of the weekends? They appears as flat lines and muck up my ATR!

Cheers,


CanOz
 

Attachments

  • aa amibroker query.jpg
    aa amibroker query.jpg
    201.8 KB · Views: 5
Hi Guys,

I'm new to Amibroker and I was hoping to get some help with this hopefully simple question.

When you perform a backtest of a trading strategy, Amibroker generates a list of trades which includes such variables as tick symbol, price, date of entry and exit etc.

My question is can I get this output to include extra variables such as the industry that the ticker belongs to and the average volume (eg. 40 week exponential moving average) at entry and exit dates?
 
Hi Guys,

I'm new to Amibroker and I was hoping to get some help with this hopefully simple question.

When you perform a backtest of a trading strategy, Amibroker generates a list of trades which includes such variables as tick symbol, price, date of entry and exit etc.

My question is can I get this output to include extra variables such as the industry that the ticker belongs to and the average volume (eg. 40 week exponential moving average) at entry and exit dates?


Custom backtest interface see manual
 
Thanks to Amibroker's Support here is the code if anyone is interested.

// First we need to enable custom backtest procedure AND tell AmiBroker to use current formula

SetCustomBacktestProc("");

//-----------------------------------------------------------------------------------------

// Now custom-backtest procedure follows

if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject(); // Retrieve the interface to portfolio backtester

bo.Backtest(1); // Set to 1 to turn off automatic calling of trade list so per-trade variables can be added

// Iterate through closed trades
for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
Industry = StaticVarGetText( trade.symbol + "Industry"); // Adding Industry Variable
trade.AddCustomMetric("Industry", Industry );

ForeignVol = StaticVarGet( trade.Symbol + "Volume"); // Adding Industry Variable
trade.AddCustomMetric("Entry Volume", Lookup(ForeignVol,Trade.EntryDateTime) );
}

bo.ListTrades(); // Now we call the trade list procedure after adding the variables we wanted
}

//----------------------------------------------------------------------------------------------

// TRADE SYSTEM CODE HERE

// Code to retain variables to be outputted in the back test trade list

StaticVarSetText( Name() + "Industry", IndustryID(1) ); // Industry Variable we want to add
StaticVarSet( Name() + "Volume", EMA(V,40) ); // Volume Variable we want to add

// Buy and Sell Code

Buy = Cross( MACD(),Signal() );
Sell = Cross( Signal(), MACD() );
 
hello
just join this forum i did some reading and i see there are people who knows there way around Amibroker i am from south Italy i did live in New York for many years so my writing in English is so so just want to say hello to every one ciao
 
Hi all. This is my Bollinger breakout/breakdown code. For some reason it's only showing $100m+ companies. Can anybody tell me (no coding knowledge) what I need to change to show ALL ASX bollinger breakout companies? Is there a filter in here, or is it in Amibroker?:confused:

Cheers

Band= (BBandTop( C, 20, 2 ) - BBandBot( C, 20, 2)) / MA(Close, 20 ) * 100;
B= ((Close - BBandBot( Close, 20, 2 )) / (BBandTop( Close, 20, 2 ) - BBandBot( Close, 20, 2 ))) * 100;

Buy = band < 15 AND b > 95 AND MFI(10) > 60;
Sell = Cross(Close,SAR(0.01,0.2));
Short = band < 15 AND b < 5 AND MFI(10) < 40;
Cover = Cross(SAR(0.01,0.2), Close);

Filter = (band < 15 AND b > 95 AND MFI(10) > 60) OR (band < 15 AND b < 5 AND MFI(10) < 40);

NumColumns = 1;
Column0 = Close;
 
Have a problem which I hope someone can assist with. I am testing a weekly system which enters at the open on the Mondayafter the entry signal and exits the same way. Unfortunately what my system is doing is say it gets an entry signal on Thursday it takes the open of the Monday of that week i.e. before the signal has occurred and exits in the same way, gets an exit signal on say a Wednesday and instead of waiting till the following Monday it takes the open of the Monday of the signal week. This seriously distorts the data and I am unable to fix it,. Have set TradeDelay to (1,1,1,1) but no joy. Hoping someone can help as its beyond me.
Many thanks.
Peter :)
 
Hi Bailey55,

It sounds like your Weekly data is set to "expandFirst"......you'll need "expandLast" to get the behavior you desire.
 
Hi All.....kinda quiet lately.

Since AB has gone the multi-thread route, I'm wondering about how to manage the timing between panes/threads.

Say I've got a larger-than-usual amount of calculations that requires 90 seconds to perform . If I could split that up and "share" the load among 3 separate panes (threads), would it not provide a substantial enhancement to the process?

It seems to me that one will need a "trigger" mechanism for "refreshing" a given pane. Plus, knowing the order of processing for the panes. I'm really a newbie on this stuff......thus, the posting of my thoughts here.

Any ideas or comments ???
TIA!
 
What on earth is that complex that it requires 90 seconds to calculate? Do you wanna prove to be smarter than Einstein? ;) I have made codes with thousands of lines of code that are still in millisecond territory.
 
Have a problem which I hope someone can assist with. I am testing a weekly system which enters at the open on the Mondayafter the entry signal and exits the same way. Unfortunately what my system is doing is say it gets an entry signal on Thursday it takes the open of the Monday of that week i.e. before the signal has occurred and exits in the same way, gets an exit signal on say a Wednesday and instead of waiting till the following Monday it takes the open of the Monday of the signal week. This seriously distorts the data and I am unable to fix it,. Have set TradeDelay to (1,1,1,1) but no joy. Hoping someone can help as its beyond me.
Many thanks.
Peter :)

What about removing the trade delay and having Buyprice = Open (which is always Monday's open in weekly testing). If your buy condition is an MA cross, just have Buy = Ref(H,-1)>= Ref(MA(C,1),-1)). Does that work? Whether the cross triggers on a Thurs or Wed should be of no consequence, I imagine.
 
4*90 seconds in a chart pane? This is 6 minutes. How many lines is the code? Have you checked multiple calls of same functions?

It is not unusual to see 50,000+ lines of code.

With regard to duplicate function calls, that is a sound recommendation of what to be aware of.....thanks for the reminder;).
 
Top