This is a mobile optimized page that loads fast, if you want to load the real page, click this text.

Amibroker Newbie

Joined
7 June 2007
Posts
28
Reactions
0
Hi All,
I am trying to return a list of stocks where the price has increased 500% since 2014.
So I am thinking of the below...but to be honest have no idea if I am even close to the right approach...I have an array "fivetimes" and trying to get count of bars since the price was 5 times lower...??? Any comments appreciated.

fivetimes=BarsSince(C/5)>0;
AddColumn(fivetimes,"fivetimes",1.4);
 
If you want to know the number of bars since the close price was 5 * smaller than now

Bars = BarsSince( Close * 5 < LastValue( Close ) ) ;

If you want to compare the price between two dates

StartDate = "2014-01-01" ;

StartClose = Lookup( Close, _DT( StartDate ), 1 ) ;

Filter = Close > StartClose * 5 ;
 
Hey Guys
This is what I have explored...but it misses many tickers that qualify.
AC8 for example goes up by 5 times but is not flagged int he exploration.
Thoughts? TIA...

StartDate = "2014-07-01" ;
StartClose = Lookup( Close, _DT( StartDate ), 1 ) ;
Buy=C>startclose*5;
Sell=0;
Filter=Close > StartClose * 5;
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
AddColumn(buy,"fivetimes",5);
AddColumn(Close,"Close 30/6/2018",1.4);
AddColumn(startclose,"close 1/7/2014",1.2);
 
Hi again,
My exrem is not working...getting multiple signals in exploration...any ideas?? TIA>

StartDate = "2014-01-07" ;
StartClose = Lookup( C, _DT( StartDate ), 1 ) ;
Buy = C > startclose * 5;
Sell = 0;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Filter = C > startclose * 5;
AddColumn(C > startclose * 5,"fivetimes",5);
AddColumn(Close,"Close 30/6/2018",1.4);
AddColumn(startclose,"close 1/7/2014",1.4);
AddColumn(startclose*5,"start * 5",1.4);
 

Attachments

  • problem.jpg
    154.6 KB · Views: 8
Try changing you filter to the following, then your ExRem will work

Filter = Buy;
 
Try changing you filter to the following, then your ExRem will work

Filter = Buy;

Agreed, Exrem does work with filter = buy, but the exploration then omits many candidates that qualify under the buy rule. I am filtering for ASX stocks that are operating holding companies and setting the date range 1 July 2014 to 30 June 2018.
AC8 is an example. It has the 500% price rise, but is omitted using the exrem statement.
Confused...

If I comment out the exrem statement and get far more "up by 500%" stocks. Confused...
StartDate = "2014-01-07" ;
StartClose = Lookup( C, _DT( StartDate ), 1 ) ;
Buy = C > startclose * 5;
//Buy = ExRem( Buy, 0 );
Filter = buy;
AddColumn(C > startclose * 5,"fivetimes",5);
AddColumn(C,"Close 30/6/2018",1.4);
AddColumn(startclose,"close 1/7/2014",1.4);
AddColumn(startclose*5,"start * 5",1.4);
 
This is way harder than it should be

I get



Code:
StartDate = "2014-01-07" ;
StartClose = Lookup( C, _DT( StartDate ), 1 ) ;
Buy = C > (startclose * 5);
Sell = 0;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Filter = Buy AND StrLen( Name () ) == 3;
AddColumn(C > startclose * 5,"fivetimes",5);
AddColumn(Close,"Close 30/6/2018",1.4);
AddColumn(startclose,"close 1/7/2014",1.4);
AddColumn(startclose*5,"start * 5",1.4);
 

Yeah agreed,
I still dont get the same result...??? No AC8 for instance...using above code...
 
I see you have a filter applied AC8 is in the All Industries watch list, try selecting All symbols

and you are limiting search to dates try all quotes. then we can move forward
 
I see you have a filter applied AC8 is in the All Industries watch list, try selecting All symbols

and you are limiting search to dates try all quotes. then we can move forward


Okay,
With Exrem on, using all symbols and all quotes AC8 is picked up but only in 1999 -which is correct - first instance only. If I set the date range to 2014-2018, then AC8 is rejected, but only when Exrem is used. Image is with exrem commented out. Note the 2017 AC8 entries are included.

 


Heading out to work...wont reply for several hours...cheers and thanks
 

The ExRem function removes excess signals. ExRem( Buy, Sell ) means you will get one buy signal then nothing until you get a sell signal then nothing until you get a buy signal and so on. You have a Sell rule but it will never be true so you will only ever get a single buy.

Your Buy rule is comparing the close price on your start date with every close price through history and the first time that happened was 28-Jan-1999. Even when you set the date range to be 2014-2018 Amibroker still knows the first buy signal was in 1999.

With the ExRem function Amibroker knows you had a buy signal before the start of your date range so will not display the symbol until you get a sell signal (which you never get) then the next buy signal...

Two changes you could make are add a valid sell signal and filter buy and sell signals to dates after your start date. Something like

StartDate = "2014-01-07" ;
StartClose = Lookup( C, _DT( StartDate ), 1 ) ;
Buy = Close > ( startclose * 5) AND DateTime() >= StrToDateTime( StartDate ) ;
Sell = Close < ( startclose * 4.5 ) AND DateTime() >= StrToDateTime( StartDate ) ; ;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Filter = Buy ;

A scan of AC8 should return

 


Awesome everyone, problem solvered....thanks a heap.
 
Hi All, I am very new amibroker user, I’ve been experimenting with some simplistic back testing on asx historical equities. I have a query around recommended position sizing methods during back testing and would greatly appreciate any guidance or reference to historical threads that would have discussed this in the past.
Initially I was using a fixed percentage of capital and a maximum number of open positions as an input but with 100k starting capital and 5pct capital allocation per trade the trade size grows over long testing periods to what seems unrealistic levels to me. As a counter to this I run a fixed $ amount per trade as an input with an increase to the maximum number of open positions.
Over the same system the fixed $ amount per trade approximately halves CAGR versus the 5pct capital allocation.
I would be greatful to hear if I’m way of the mark with this kind of approach to position sizing in terms of good practice to generating back testing results and any other recommended methods I could investigate.
 
Suggest to read about OOS (out of sample/walk forward testing) and read some of Howard Bandy's books. Howard used to contribute here, try the search function.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more...