Australian (ASX) Stock Market Forum

Amibroker FAQ

Looking at creating a workshop course, 1 day, probably around $400 or more (need to check costs of a venue and catered lunch ... although may have a introductory reduced fee for the first workshop), which will include a workshop book and cd (which includes code) but only a small class - 5-8 max.

Morning session will be basics ... introduction, overview of Amibroker, and basic usage etc ... then afternoon session much more advanced stuff ... addtocomposite, position sizing methods, and loops (providing some very useful and fully explained examples).

Anyhow send me a pm if interested, and what you would like to see in a workshop.

If this goes ahead based on interest, the courses will only be available in Sydney to start with, and won't be available for a few months until content and course is fully developed. The main goal for me, is to ensure that anyone that attends, receives much more than expected value from the course.

Wysiwyg, Weird, thanks. I'll read up the most basic of Amibroker, have a think abt what I wish to get out of the session and get back to you. At the moment, just reading some of the program writing codes is enough to send my head spinning, just hasn't been wired up that way. :confused:
 
There are some who believe that random selection of trades is a valuable technique and use Monte Carlo methods to select trades randomly when there are more trades signaled than there is money to take them all. I strongly disagree with that approach and suggest that real traders trading real money do not select trades randomly -- they always have a preference. Rather, use AmiBroker's PositionScore to add criteria to allow ties to be broken using metrics that you define that rank the alternatives into the order you prefer. That is, do not use PositionScore = Random();


Howard - This is the reason that I'm looking at montecarlo, because my trading system has more entries that postions available, and I'm wondering how the alphabetical selection of trades affects the results. I agree, I would always look at the buy signals and then make a choice which is not altogther random, however, I am not sure how I would code my "visual" trade choice. So I just thought if I could do some monte carlo, it would give me a range of how the trading system performed.

Captn Black - i'll check out the walk forward function and see if that fixes my issues.

General comment - my personality is such that I need to know (by evidence such as backtesting) that my trading system is robust and profitable, otherwise I hesitate on don't take trades when they come up. Any other ideas on how to gain that confidence in my trading system??

Thanks! I'm off to move house. Maybe I should change my user name from Australindgirl to Perthgirl!! Yay!
 
Hi all,

how do you backtest delisted securities in Amibroker? I have the data but if I backtest it I just end up in a bunch of delisted securities and it never sells them? so after about a 10 year period I end up in 10 delisted securities (positionsize=-10) with my profit/losss going nowhere?

Cheers,

Harro
 
Hi all,

Any ideas on how I might check if (and possibly the number of times) my buy signal has been triggered over the last x days when back-testing?

I am looking to only take the first entry of a breakout...

Cheers :)
 
Think I have worked it out...

LastBuySignal = BarsSince(Ref(BuyList, -1));
NoRecentBuys = LastBuySignal > PreviousBuyDays ;

where BuyList is my temporary Buy array.
 
Hi all,
If this is the wrong place for this question please let me know.It seems pretty simple compared to some of the stuff here but before i go ahead and trial AB i need to know if the backtesting can supply certain info.
Can the programme give me buy and sell signals for example on a stoch:8 indicator turning up/down from oversold/bought,using my parameters on any chosen historical timeframe.
If so can the results be sorted into ave win/loss and hit ratios etc to allow me to calculate the mathematical expectancy of the stock.
If this is possible can additional info be sourced from the result such as brokerage and slippage allowances,compounded returns and average profits/loss etc,etc.

Hope someone can help,:D

Sparfarkle
 
Hi all,

how do you backtest delisted securities in Amibroker? I have the data but if I backtest it I just end up in a bunch of delisted securities and it never sells them? so after about a 10 year period I end up in 10 delisted securities (positionsize=-10) with my profit/losss going nowhere?

One way is to check through your list of delisted security trades and find out the date they were delisted (ie. last trade date). Then add a condition to your sell criteria.

eg. Company "XYZ" last traded on 23rd April: (datenum in code assumes tradedelay of 1)

Code:
Delisted = DateNum() == 1100422 AND Name() == "XYZ";

Buy = your buy conditions....;
Sell = your sell conditions OR Delisted;
Of course if the company went into liquidation etc unexpectedly then you would have to take that trade as a 100% loss which would involve adjusting your Sellprice.
 
Hi all,
If this is the wrong place for this question please let me know.It seems pretty simple compared to some of the stuff here but before i go ahead and trial AB i need to know if the backtesting can supply certain info.
Can the programme give me buy and sell signals for example on a stoch:8 indicator turning up/down from oversold/bought,using my parameters on any chosen historical timeframe.
If so can the results be sorted into ave win/loss and hit ratios etc to allow me to calculate the mathematical expectancy of the stock.
If this is possible can additional info be sourced from the result such as brokerage and slippage allowances,compounded returns and average profits/loss etc,etc.

Hope someone can help,:D


Sparfarkle

Yes, all this can be done. A read through the documentation on the Amibroker support pages will explain it all.

http://www.amibroker.com/support.html

The Amibroker Yahoo Group is very useful for specific coding issues

http://finance.groups.yahoo.com/group/amibroker/messages/
 
Hi C.B.
Thanks for the info,a lot of stuff to get thru,especially for the technically unsavvy.
This seems a great place for genuine AB information,yourself especially,and im sure ill be using it a lot once i purchase the AB package.:D

Thanksalot,
Sparf
 
Hi

Can someone please tell me if there is an AFL available that I could use to scan a list of tickers to see which ones have made a higher low and a higher high after the end of a downtrend? Its way out of my coding ability.

Thanks :)
 
after the end of a downtrend

You'll need to define the conditions that signify the end of a downtrend. eg. Price has been below a 40 day moving average for the last "x" days and crosses above etc.

Higher high and higher low would be:

Code:
HH_HL = H > Ref(H,-1) AND L > Ref(L,-1);
 
Thanks Capt.

That sort of works. I think what Im after is hard to define. I want to make an exploration to find out which tickers have come out of a downtrend and rebounded for a few days then pulled back and formed a higher low and then taken out the recent high. Im thinking it depends on how many days you give it to do each thing and that would be hard to define. Is there a way to do this with an exploration or would it have to be done manually? If what Ive just said isnt really possible then how would I turn that code into an exploration?
 
That sort of works. I think what Im after is hard to define.

It may be worthwhile playing around with the AFL coding wizard and plotting a few different ideas on a chart to see if you're able to get a clearer definition of the end of a downtrend and a rebound etc. Don't waste time with indicators, just try a few differnet ideas with price action. ie. Price has been higher than the lowest low of 40 days for 10 days etc.

Sorry I can't be more help but looking at a price chart and trying to define what you see in the code wizard is a good way to understanding code structure.

There's also some great stuff in the AFL library, beware of using any forward looking code for backtesting. Most of the pattern recognition code tends to use peak/trough/zig functions which are great for charting patterns but not so great for backtesting.
 
OK I see what you mean. I will try that.

Ive never made an exploration before. Is there a filter that will return only the tickers that made a higher high and a higher low TODAY?

Thanks



HTML:
Buy = H > Ref(H,-1) AND L > Ref(L,-1);

Sell = 0; 

Filter=Buy OR Sell;
AddColumn(Close,"Close",1.4);
AddColumn( DateTime(), "Date", formatDateTime );
 
OK I see what you mean. I will try that.

Ive never made an exploration before. Is there a filter that will return only the tickers that made a higher high and a higher low TODAY?

This will show true (1) in the Buy column where Higher high and higher low than yesterday is true.

Code:
Buy = H > Ref(H,-1) AND L > Ref(L,-1);
Sell = 0; 

Filter=Buy ;
AddColumn(Buy,"Buy");
AddColumn( DateTime(), "Date", formatDateTime );
http://www.amibroker.com/guide/h_exploration.html
 
Looking at creating a workshop course, 1 day,

.....

Anyhow send me a pm if interested, and what you would like to see in a workshop.

Hi weird. I would definitely be interested in attending. I am using amibroker now, and would love a run through of the basics, including scans & explorations, as well as some of the more difficult topics (basically as much as you could teach in the time)

You asked for a pm, but it appears you have pm's turned off.

Hope to hear from you soon,

bertieb
 
It may be worthwhile playing around with the AFL coding wizard and plotting a few different ideas on a chart to see if you're able to get a clearer definition of the end of a downtrend and a rebound etc. Don't waste time with indicators, just try a few differnet ideas with price action. ie. Price has been higher than the lowest low of 40 days for 10 days etc.


I have tried a few different ideas and then I started thinking about the swing chart that I have. If this AFL already plots the swings that I want to use to create a buy signal then I would think that the code that I want is within this AFL but I dont know what Im looking for. Is it here anywhere?


HTML:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

/* Gann Swing chart v4 */
/* Last modified 24 Feb 2001 */
/* AFL implementation by */
/* (C)2001 Tomasz Janeczko  */
/* one and two - bar reversal version */

/* Change this to 1 for two-bar mode */
twobarmode = 0;

outsidebar = Outside();
insidebar = H <= Ref( H, -1 ) AND L >= Ref( L, -1 ); // built-in inside() works with < > instead of <= >=

upbar = H > Ref( H, -1 ) AND L >= Ref( L, -1 );
downbar = L < Ref( L, -1 ) AND H <= Ref( H, -1 );

upbar2 = upbar OR ( outsidebar AND Ref( downbar, 1 ) ) ;
downbar2 = downbar OR ( outsidebar AND Ref( upbar, 1 ) );

Poi =  outsidebar AND Ref( insidebar, 1 );
Poo =  outsidebar AND Ref( outsidebar, 1 );
Pooi = Poo AND Ref( insidebar, 2 );
Poio = Poi AND Ref( outsidebar, 2 );
Poii =  Poi AND Ref( insidebar, 2 );
Pooo = Poo AND Ref( outsidebar, 2 );
Poooi = Pooo AND Ref( insidebar, 3 );
Pooio = Pooi AND Ref( outsidebar, 3 );
Poioo = Poio AND Ref( outsidebar, 3 );

upbar3 = upbar2 OR ( Poi AND Ref( downbar, 2 ) );
downbar3 = downbar2 OR ( Poi AND Ref( upbar, 2 ) );
 
upbar4 = upbar3 OR ( Poo  AND Ref( upbar, 2 ) );
downbar4 = downbar3 OR ( Poo  AND Ref( downbar, 2 ) );

upbar5 = upbar4 OR  ( Pooi AND Ref( upbar, 3 ) );
downbar5 = downbar4 OR  ( Pooi  AND Ref( downbar, 3 ) );

upbar6 = upbar5 OR  ( Poio AND Ref( upbar, 3 ) );
downbar6 = downbar5 OR  ( Poio  AND Ref( downbar, 3 ) );

upbar7 = upbar6 OR  ( Poii AND Ref( downbar, 3 ) );
downbar7 = downbar6 OR  ( Poii  AND Ref( upbar, 3 ) );

upbar8 = upbar7 OR  ( Pooo AND Ref( downbar, 3 ) );
downbar8 = downbar7 OR  ( Pooo AND Ref( upbar, 3 ) );

upbar9 = upbar8 OR  ( Poooi AND Ref( downbar, 4 ) );
downbar9 = downbar8 OR  (Poooi  AND Ref( upbar, 4 ) );

upbar10 = upbar9 OR  ( Pooio AND Ref( downbar, 4 ) );
downbar10 = downbar9 OR  (  Pooio AND Ref( upbar, 4 ) );

upbar11 = upbar10 OR  (  Poioo AND Ref( downbar, 4 ) );
downbar11 = downbar10 OR  ( Poioo  AND Ref( upbar, 4 ) );

fupbar = upbar11;
fdownbar = downbar11;
 
// Two-bar mode handling
fupbar = IIf( twobarmode, fupbar AND Ref( fupbar, 1 ), fupbar );
fdownbar = IIf( twobarmode, fdownbar AND Ref( fdownbar, 1 ), fdownbar );

/* Barcount since most recent up and down swings */
Us = BarsSince( fupbar  ); 
Ds = BarsSince( fdownbar ) ;

Sd1 =IIf( Us==0, 1,  IIf( Ds==0, -1, 0) );

Sd2 = IIf( Sd1 == 1,  IIf( Ref( BarsSince(Sd1==1), -1) > Ref( BarsSince( Sd1 == -1), -1), 1, 0), 
          IIf( Sd1 == -1,  IIf( Ref( BarsSince(Sd1==1),-1) < Ref( BarsSince( Sd1 == -1),-1), -1, 0),  0 ) ); 

g0 =  ValueWhen( Sd2, Sd2 ); /* sample and hold non-zero values */

/* shift back one bar, add one dummy swing at the end and shift forward */
/* to ensure proper handling of the last swing */
lastbar = Cum(1) == LastValue( Cum(1) );
swinglevel = IIf( g0 == -1, HighestSince( Sd2 == 1, H ), LowestSince( Sd2 == -1, L ) );
swinglevel = IIf( lastbar, IIf( g0 == -1, LowestSince( Sd2 == -1, L ), HighestSince( Sd2 == 1, H )), Ref( swinglevel, 1 ) );

/* Gann Swing chart drawn here */
myGraph1 =  Ref( ValueWhen( Ref( Sd2 != 0, 1 ) OR lastbar, swinglevel , 
 0 ), -1 );
Plot( myGraph1, "graph1", colorBlack, styleStaircase|styleSwingDots);
GraphXSpace = 5;

/* Colourized price bars drawn here */
/* graph0 = close; */
/* graph0style = 128; */
/* barcolor =  IIF( outsidebar, 1, IIF( downbar, 4, IIF( upbar, 5, 0 ) ) ); */
/* graph0barcolor = ValueWhen( barcolor != 0, barcolor ); */

ANZ.gif
 

Attachments

  • ANZ.gif
    ANZ.gif
    6.4 KB · Views: 0
Top