Australian (ASX) Stock Market Forum

Amibroker Simple Backtests

Yes, but many of the results will be duplicates from the previous day(s). Eg. You'd be entering a trade the first time it shows up on your list, making a new high. You wouldn't also enter another position in the same stock the following day when it closes even higher, and again the day after that when it closes higher still.

One thing you could do would be to change the code so it only gives you the first new high, after it has been below the HHV for 1 or more days. Have a think how you'd code that. I find it often helps to draw the daily bars of the setup you're looking for on a piece of paper so you can more easily visualise what you're trying to code.


I know what you're saying. I've drawn out the set ups I am looking for but am struggling to come up with answers.
The first part obviously has to be HHV of last 10 (or however many) days. I'm not sure how to ensure the same stock doesn't come up as it moves even higher the next day.

Is there any formula that I can enter that doens't show results for a company where the HHV of the last 10 days has been breached for 2 consecutive days? I'd have no idea how to code that.
 
I know what you're saying. I've drawn out the set ups I am looking for but am struggling to come up with answers.
The first part obviously has to be HHV of last 10 (or however many) days. I'm not sure how to ensure the same stock doesn't come up as it moves even higher the next day.

Is there any formula that I can enter that doens't show results for a company where the HHV of the last 10 days has been breached for 2 consecutive days? I'd have no idea how to code that.

If you're simply looking to remove excess signals for n bars then exremspan will do that.

http://www.amibroker.com/guide/afl/afl_view.php?id=50

eg.
Code:
[B]buysignal =Cross(C, Ref(HHV(C,10),-1))[/B];
exremspan(buysignal , 5); //no more buy signals for 5 bars even if further higher closes
 
If you're simply looking to remove excess signals for n bars then exremspan will do that.

http://www.amibroker.com/guide/afl/afl_view.php?id=50

eg.
Code:
[B]buysignal =Cross(C, Ref(HHV(C,10),-1))[/B];
exremspan(buysignal , 5); //no more buy signals for 5 bars even if further higher closes

How do I slot something like that into an exploration, such as below:


Filter = ((C > Ref(HHV(C,40),-1) AND C>O AND H>MA(C,40)) OR (C < Ref(LLV(C,40),-1) AND C<O AND L<MA(C,40)))

AND C < 7
AND V*C>2000000;




AddColumn (C,"Close");
AddColumn (V,"Volume");
AddColumn (V*C,"Liquidity");
 
How do I slot something like that into an exploration, such as below:

Simple. Just replace the C > HHV and C < LLV bits with the Cross bit. Using Cross instead of > and < will just give you the day that the new high or low was crossed, rather than the following days as well. Like this:

Filter = ((Cross(C,Ref(HHV(C,40),-1)) AND C>O AND H>MA(C,40)) OR (Cross(Ref(LLV(C,40),-1),C) AND C<O AND L<MA(C,40)))
AND C < 7
AND V*C>2000000;

AddColumn (C,"Close");
AddColumn (V,"Volume");
AddColumn (V*C,"Liquidity");
 
Simple. Just replace the C > HHV and C < LLV bits with the Cross bit. Using Cross instead of > and < will just give you the day that the new high or low was crossed, rather than the following days as well. Like this:

Filter = ((Cross(C,Ref(HHV(C,40),-1)) AND C>O AND H>MA(C,40)) OR (Cross(Ref(LLV(C,40),-1),C) AND C<O AND L<MA(C,40)))
AND C < 7
AND V*C>2000000;

AddColumn (C,"Close");
AddColumn (V,"Volume");
AddColumn (V*C,"Liquidity");

Ok this comes up perfect now. Narrowed down my results. This is what I got:

>/< Cross
11-Mar 28 8
10-Mar 46 18
9-Mar 32 12
8-Mar 28 14
7-Mar 27 19


Can you please explain this to me. I am sorry for my ignorance. I understand the difference in results, where one that crossed a HHV or LLV in the last few days doesn't show up, but what is the actual difference between "Cross" and "< or >" ?

If the stock trades higher then wouldn't it again be crossing the 40 day high value? This is what I don't understand.
Does it measure if the 40 day high value was crossed multiple times in the past few days?

Thanks
 
Also do people think a liquidity of 2,000,000 is too excessive? is 1,000,000 or even 500,000 a better measure?
 
what is the actual difference between "Cross" and "< or >" ?

Well if we take a cross above the HHV for example, a "Cross" means that it has crossed above, ie. yesterday it was below the HHV and today it is above, so it has crossed from below to above.

">" only means it is above today. It could have been above yesterday as well. With the "Cross" it could not have been above yesterday, it must have been below yesterday.
 
Also do people think a liquidity of 2,000,000 is too excessive? is 1,000,000 or even 500,000 a better measure?

2,000,000 seems excessive to me. I'd think 500,000 would be more reasonable.

It depends to a large extent on what size positions you're using. If you were trading $1 Million positions, then you'd be looking for liquidity of several million or more, but if you're trading $5,000 then perhaps $100,000 may be high enough. It just needs to be high enough so that you won't suffer excessive slippage getting in and out, ie. so that your order won't move the share price to a great degree.
 
Oh, I forgot to mention that with your liquidity filter, you'd be better of averaging it over several days to get a more 'typical' daily figure. As you'd be aware, the volume can change enormously from day to day. You're only looking at the current day's figure, which may be much higher, or lower, than what is usual for this stock.
 
Oh, I forgot to mention that with your liquidity filter, you'd be better of averaging it over several days to get a more 'typical' daily figure. As you'd be aware, the volume can change enormously from day to day. You're only looking at the current day's figure, which may be much higher, or lower, than what is usual for this stock.

Do I have it as say, an average of 500,000 over the last 10 days? Or above the MA of volume in the last 10 days? (or however many days).

How would I code that?
Would the MA one be: V>MA(V,10)?
What about the average?
 
Do I have it as say, an average of 500,000 over the last 10 days? Or above the MA of volume in the last 10 days? (or however many days).

How would I code that?
Would the MA one be: V>MA(V,10)?
What about the average?

I was thinking of something like MA(V*C,10) > 500000;
 
Top