Australian (ASX) Stock Market Forum

Amibroker FAQ

AFAIK Howard Bandy can code up a system for you, although he may be busy finishing off his latest book atm, may be worth getting in touch with.

http://www.blueowlpress.com/

I do some coding but have no free time atm. I'm sure you don't want to share your whole system publicly but you may wish to post some of the basic structure here and people may be able to help you with converting it to AFL?

Otherwise the Amibroker Yahoo User's Group could probably point you to someone if you wished to post the question there. Sorry I can't be of more assistance. Best of luck with the project :)

I got a reply from Howard, and as you suspected he's tied up with work at the moment for a few months, and has pointed me in the same direction as yourself and ‘colion’, i.e.

http://finance.groups.yahoo.com/group/amibroker/

http://www.amibroker.com/

Cheers
 
Appreciate it if someone can convert the following Metastock code to AB code, thanks.
Mov(Mov((WillA()-(Ref(WillA(),-1))),14,E),7,E);
 
Appreciate it if someone can convert the following Metastock code to AB code, thanks.
Mov(Mov((WillA()-(Ref(WillA(),-1))),14,E),7,E);

WiilA being the "Larry Williams Accumulation/Distribution indicator"

This is the WillA indicator code (taken from the AB site):

TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad);
Plot(WAD, "Williams AD", colorBlue);
Plot(ad, "AD daily", colorRed, styleOwnScale | styleNoLine |
styleNoLabel );

AddColumn(ad, "AD");
AddColumn(wad, "WAD");
Buy = Sell = C;
Filter = Buy OR Sell;
 
WiilA being the "Larry Williams Accumulation/Distribution indicator"

This is the WillA indicator code (taken from the AB site):

TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad);
Plot(WAD, "Williams AD", colorBlue);
Plot(ad, "AD daily", colorRed, styleOwnScale | styleNoLine |
styleNoLabel );

AddColumn(ad, "AD");
AddColumn(wad, "WAD");
Buy = Sell = C;
Filter = Buy OR Sell;

I'm not overly familiar with MS Language but I'll have a stab and we'll see if we can work this out....

Code:
TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad); //this gives us the WillA() component hopefully

//Mov(Mov((WillA()-(Ref(WillA(),-1))),14,E),7,E);     
//The MS formula above
// My AFL attempt below

neilsends_indicator = EMA(EMA((WAD-Ref(WAD,-1)),14),7);
Whack a plot statement at the end and plot it as an indicator and see if it looks anything like the MS one :)
 
Thanks Captain Black. I'm not much of a coder, stuck on the plot line:

_SECTION_BEGIN("Farleys ADA");
TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad); //this gives us the WillA() component hopefully

Plot( "Farleys ADA" ( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 
If anyone's curious, it's a take on Alan Farleys code in pg 203 of 'The Master Swing Trader'. Someone was able to kindly provide me with the MS code, but wasn't familiar with AB.
 
This will plot it as a line, but I'm still not sure if the formula is correct, you'll need to check it and compare with the original.

Code:
TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad); //this gives us the WillA() component hopefully

//Mov(Mov((WillA()-(Ref(WillA(),-1))),14,E),7,E);     
//The MS formula above
// My AFL attempt below

neilsends_indicator = EMA(EMA((WAD-Ref(WAD,-1)),14),7);

Plot(neilsends_indicator, "neilsends indicator" , colorRed , styleLine);
 
Interested on anyone's thoughts on this indicator. Using a 15 DEMA on a 20 Range bar for AUD.USD. Looks to have some promise, if only as a confirmation with other indicators? As mentioned above it's from Alan Farleys 'The Master Swing Trader' pg 203.

TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
WAD = Cum(ad);

FarleysADA = EMA(EMA((WAD-Ref(WAD,-1)),14),7);

Plot(FarleysADA, "FarleysADA" , colorBrightGreen , styleLine);

_SECTION_BEGIN("DEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( DEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 
Can someone please have a look at the attached AB code and tell me what I’m doing wrong? I’ve posted this on the AB Yahoo forum with no response.
Basically I just want to run a simple backtest over some FX data. When I visually scan the charts I can see that there are plenty of trades, but when I run the backtest it only displays a handful?
Please can someone take a look and let me know where I’m going wrong, or even better explain what I’m doing wrong and add the necessary fixes?
 

Attachments

  • KB EOR ATR System Backtest.afl
    4.3 KB · Views: 21
Can someone please have a look at the attached AB code and tell me what I’m doing wrong? I’ve posted this on the AB Yahoo forum with no response.
Basically I just want to run a simple backtest over some FX data. When I visually scan the charts I can see that there are plenty of trades, but when I run the backtest it only displays a handful?
Please can someone take a look and let me know where I’m going wrong, or even better explain what I’m doing wrong and add the necessary fixes?

I haven't done any Forex backtesting so can't comment on any specific Forex settings but had a quick look at your AFL and noticed that the ParamToggle settings at the beginning are set to "No" by default. In your Automatic Analysis settings click on the "Param" button and change these to "Yes". (or modify the formula to set them to "Yes" by default).
 
I haven't done any Forex backtesting so can't comment on any specific Forex settings but had a quick look at your AFL and noticed that the ParamToggle settings at the beginning are set to "No" by default. In your Automatic Analysis settings click on the "Param" button and change these to "Yes". (or modify the formula to set them to "Yes" by default).

Hi CB, did this first before backtesting. Only returned the handful of trades. But thanks for offering the advice.
 
Ok, I've worked out what the problem is but I don't know how to fix it. The periodicity was set to Days. I need it to be set to '20' pip range bars? How do you set that?
 
Hi all

I've got a dilemma with my AFL code. At the moment I'm just trying to get a simple backtesting code working but got struck with the problem.
SA = EMA(C,25);
LA = EMA(C,50);

//buy and sell
Buy = Cross(SA,LA);
Sell = 0;

//variable used in the loop
EP = 0;
Inposition = 0;
Target = 0.03;

//loop
for(i=1;i<BarCount;i++){
if (Buy == 1 AND EP == 0){
EP = BuyPrice;
Inposition = 1;
//SLposition = LA-0.01*LA;
//Target = C+2*(C-LA);
}
else
if (Inposition > 0 AND High>(EP*1.03)){
Sell = 1;
SellPrice = Max(High,Target);
Inposition = 0;
}
}

Although the code does buy at the crossover it does not sell even when the price reaches the target. Not quite sure what is the problem here.

Thanks in advance.
Dre
 
Can anyone please explain why in the ApplyStop function, "Amount" cannot be manipulated outside the function?

This could be a number (static stop level) or an array (dynamic stop level.)

Just for example :-

RaiseStop = IIf(C > Ref(C, -1), 2 * ATR(30), 4 *ATR(30));

ApplyStop(stopTypeTrailing, stopModePoint, RaiseStop, 2);

The trailing stop exit is always 2* ATR(30) regardless of the condition Close > Close -1. Why does it not apply the true or false argument relevant to the condition?

Ta.
 
Can anyone please explain why in the ApplyStop function, "Amount" cannot be manipulated outside the function?

Hi Wysiwyg --

The code you have appears to be correct.

Once the trade has been entered, the value of the argument is fixed for that trade. The exit price changes, but the number of points represented by the argument does not. When that trade is complete and the next trade is entered, the then-current value will be used -- again for the entire trade.

If you want intra-trade control, you will need to write looping code to compute the exit price yourself.

Thanks,
Howard
 
I'm new to Amibroker, trying to import one year of Yahoo EOD data for the ASX. My question is more data related, but it could be something I'm doing wrong with Amibroker or Amiquote so I thought I'd ask here...

I went to the Yahoo Finance page, selected ^AORD, clicked "Components" and manually copied and pasted all of the tickers into the Amiquote Ticker List I created. However, I noticed there are only 489 tickers. I thought the ASX had about 1800 listed companies? Does Yahoo not provide data for the others or am I doing something incorrect?
 
Forget yahoo for quotes. Extremely inaccurate.

For free, try cooltrader.com.au next day at about 11am. Even this has problems but much better than nothing. You can generate a ticker list from there using a spreadsheet.
 
I thought the ASX had about 1800 listed companies? Does Yahoo not provide data for the others or am I doing something incorrect?

Hi fella.

The All Ordinary Index (^AORD) has around 500 constituents.
The ASX has all constituents. I don't know of an ASX list of constituents on Yahoo but I have a list sent to me from a paying data user.

I use Yahoo Finance EOD numbers for strategy testing and custom market explorations/scans. Works fine although they (Yahoo) don't make all quote adjustments the strategy testing knows no different.
 
Top