Australian (ASX) Stock Market Forum

Dump it Here

It's OK as long as you refer to yourself in the third person.

“Hard To Be Humble”
The lyrics of this song never go stale & only Willie Nelson could sing the song perfectly.



"Oh Lord, it's hard to be humble
When you're perfect in every way
I can't wait to look in the mirror
'Cause I get better lookin' each day
To know me is to love me
I must be a hell of a man
Oh Lord, it's hard to be humble
But I'm doing the best that I can"


Skate.
 
Last edited:
“Hard To Be Humble”
The lyrics of this song never go stale & only Willie Nelson could sing the song perfectly.



"Oh Lord, it's hard to be humble
When you're perfect in every way
I can't wait to look in the mirror
'Cause I get better lookin' each day
To know me is to love me
I must be a hell of a man
Oh Lord, it's hard to be humble
But I'm doing the best that I can"


Skate.

The 3rs line suited Farmer very well....He always look into the mirror for that bloke to direct him.....Buy or Sell...?‍♂️?‍♂️?
 
Trading with uncertain data every trade has a definite probability of loss
Trading is a game of mathematics, a game of probabilities making it a probabilistic endeavour at best. This means for any given trade that sets up, there is a probability that it will be a winner. Trading is a risky endeavour that offers good long-term returns if you can nail it consistently. Anyone can buy & sell shares, but it's all in the timing of when to buy & sell that puts the probability of success on your side. This timing can ultimately dictate how successful we will be as a trader.

This short YouTube video should be an interest to most
Good decision-making really does put the odds in your favour.



Skate.
 


Hi everyone, I've been playing with amibroker rotational strategies this last week. Playing with the concept of dual momentum.

I came across this youtube tutorial, where the presenter uses python to run a backtest on a rotational strategy. Python is not ideal for this type of analysis but I am struggling to work out how to replicate the strategy is Amibroker.

Strategy:

Watchlist = NASDAQ 100

First Rank all tickers by their 200 day ROC and take the top 50 stocks from this ranked list

Rank these top 50 stocks by their 100 day ROC and take the top 25 from this 2nd ranked list

From this final list of 25 stocks, Rank them by their 50 day ROC and take the top 10 stocks

Buy all 10 tickers with equal weighting, ie 10% each.

Rotate Monthly.

I found a tutorial by Matt Radtke, also worth a look for those interested:


I've transcribed the amibroker AFL in his video. I think the secret will lie in a nested for loop where we generate separate static variables for each ROC... ie ROC200, ROC100 and ROC50.

ROC100 = iif( rankROC200 > 50, -1e9, ROC(C,100) );

Below is Radtke's code:

C++:
#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
doTrace = False;
tkIndex = "$SPX";

// Perform opeations that only need to be done once at the start of the analysis
if (Status("stocknum") == 0 AND Status("actionex") != actionPortfolio AND Status("actionex") != actionExAAParameters){
  
    // Find the most oversold members fof the S&P500 index by rankinn in order fo the lowest rsi(2)
    StaticVarRemove("RSI2*");
    StaticVarRemove("RankRSI2*");
  
    SymList = CategoryGetSymbols(categoryWatchlist, GetOption("FilterIncludeWatchlist"));
    for (i = 0; (tkSym = StrExtract(SymList, i) ) != ""; ++i){
  
        if (doTrace) _TRACE("Setting ranking info for symbol "+tkSym);
        if (SetForeign(tkSym)){
            rsi2 = RSI(2);
          
            // Only rank stocks when they are in the index
            inIndex = NorgateIndexConstituentTimeSeries(tkIndex);
            RestorePriceArrays();
          
            StaticVarSet("RSI2"+tkSym, IIf(inIndex,100-rsi2,-1e9));
          
        }
    }
    StaticVarGenerateRanks("Rank","RSI2",0,1224);
}

// Get the relative rank for the current symbol
// Highest ranking value will have a rank of 1

rsi2Rank = StaticVarGet("RankRSI2" + Name());

// Retrieve the original value used for ranking if needed?
rsi2 = StaticVarGet("RSI2" + Name());

// Use the rank as part of your entry code

I'm just wondering if anyone has already experimented with this concept? All thoughts welcome :)

Hi all,

I just wanted to give some follow up to this post I put up a while back.

A very kind chap sent me an private message suggesting that what I was trying to do (with difficulty!), could be done quite easily in a program called REALTEST or RT, I had not heard of it and was dubious as always... I've been using Amibroker for 10+ years now but intrigued I found the youtube channel mhp trading which demonstrates the program and I have to say... (WOW)

I'll be purchasing the software as soon as my free trial (30 days) is up...

My summary of the software is quite simple. Its Amibroker but without all the annoying stuff...
- want to backtest over current and past symbols - no worries, one line of code
- need to make sure you have no future leaks with entry prices, exit price sequence for limit orders etc - no worries, the backtest engine does that automatically
- documentation - great
- examples and tutorials - great
- support forum - had a quiery - was answered with example scripts with hours (was not belittled in the help forum - a nice change)
- backtest speed --> gives amibroker more than a run for its money.
- cost --> roughly same as amibroker for a single license.

I've attached a RT script which I think does what I was trying to do in ambroker... I'll leave it to you to decide which looks simpler!

Hope this helps... I am in no way affilliated with RT, just wanted to give this software and the developer the credit which I think is thoroughly deserved.

Horses for courses, I'll still use Amibroker and Python when they are the best suited for the job.

Cheers
C++:
Notes:    Three Ranks idea: From youtube channel
    
Import:    // assumes Platinum subscription level
    DataSource:    Norgate
    IncludeList:    .NASDAQ 100 Current & Past
    IncludeList:    SPY // for bull market indicator
    Constituency:    $NDX // include Nasdaq 100 index constituency data
    StartDate:    1/1/04
    EndDate:    Latest
    SaveAs:    ndx_rotate.rtd

Settings:    DataFile:    ndx_rotate.rtd
    StartDate:    Earliest
    EndDate:    Latest
    BarSize:    Daily
    UseAvailableBars:    False
    AccountSize:    100000
    
Data:    uptrend:    c > Avg(C,200)
    bullmkt:    Extern($SPY, uptrend)
    roc252:    ROC(C,252)
    roc126:    ROC(C,126)
    roc63:    ROC(C,63)
    canhold:    InNDX and bullmkt and C > 10 and uptrend
    rank1:    #rank (canhold * roc252)
    rank2:    #rank ((rank1 < 50) * roc126)
    rank3:    #rank ((rank2 < 25) * roc63)

    posrank:    rank3

Parameters:    positions:    10
    worstrank:    10 // set to > 10 to hold positions longer, set to 0 for monthly rebalance
    
Strategy:    ndx_rotate
    Side:    Long
    Quantity:    100 / positions
    QtyType:    Percent
    MaxPositions:    positions
    EntrySetup:    EndOfMonth and  canhold and posrank <= positions
    EntryScore:    roc63
    ExitRule:    EndOfMonth and (posrank > worstrank or not canhold)

1671539448871.png
1671539522651.png

1671539491179.png
 

Attachments

  • 1671539516263.png
    1671539516263.png
    78.9 KB · Views: 5
Hon
Most markets going down, it's wait and see time. That is, see if if stops or keeps on going.
Honestly, most of us have an opinion of the Market but non of us dare to voice it loud.
50% of experts claim this is one hell of a fall.
The other 50% claim that everyone in the Stock market will be Standing naked except with our underwears.
 
Hon
Honestly, most of us have an opinion of the Market but non of us dare to voice it loud.
50% of experts claim this is one hell of a fall.
The other 50% claim that everyone in the Stock market will be Standing naked except with our underwears.
Good evening Rabbito some half right and some half wrong !!!!
 
Hi all,

I just wanted to give some follow up to this post I put up a while back.

A very kind chap sent me an private message suggesting that what I was trying to do (with difficulty!), could be done quite easily in a program called REALTEST or RT, I had not heard of it and was dubious as always... I've been using Amibroker for 10+ years now but intrigued I found the youtube channel mhp trading which demonstrates the program and I have to say... (WOW)

I'll be purchasing the software as soon as my free trial (30 days) is up...

My summary of the software is quite simple. Its Amibroker but without all the annoying stuff...
- want to backtest over current and past symbols - no worries, one line of code
- need to make sure you have no future leaks with entry prices, exit price sequence for limit orders etc - no worries, the backtest engine does that automatically
- documentation - great
- examples and tutorials - great
- support forum - had a quiery - was answered with example scripts with hours (was not belittled in the help forum - a nice change)
- backtest speed --> gives amibroker more than a run for its money.
- cost --> roughly same as amibroker for a single license.

I've attached a RT script which I think does what I was trying to do in ambroker... I'll leave it to you to decide which looks simpler!

Hope this helps... I am in no way affilliated with RT, just wanted to give this software and the developer the credit which I think is thoroughly deserved.

Horses for courses, I'll still use Amibroker and Python when they are the best suited for the job.

Cheers
C++:
Notes:    Three Ranks idea: From youtube channel
 
Import:    // assumes Platinum subscription level
    DataSource:    Norgate
    IncludeList:    .NASDAQ 100 Current & Past
    IncludeList:    SPY // for bull market indicator
    Constituency:    $NDX // include Nasdaq 100 index constituency data
    StartDate:    1/1/04
    EndDate:    Latest
    SaveAs:    ndx_rotate.rtd

Settings:    DataFile:    ndx_rotate.rtd
    StartDate:    Earliest
    EndDate:    Latest
    BarSize:    Daily
    UseAvailableBars:    False
    AccountSize:    100000
 
Data:    uptrend:    c > Avg(C,200)
    bullmkt:    Extern($SPY, uptrend)
    roc252:    ROC(C,252)
    roc126:    ROC(C,126)
    roc63:    ROC(C,63)
    canhold:    InNDX and bullmkt and C > 10 and uptrend
    rank1:    #rank (canhold * roc252)
    rank2:    #rank ((rank1 < 50) * roc126)
    rank3:    #rank ((rank2 < 25) * roc63)

    posrank:    rank3

Parameters:    positions:    10
    worstrank:    10 // set to > 10 to hold positions longer, set to 0 for monthly rebalance
 
Strategy:    ndx_rotate
    Side:    Long
    Quantity:    100 / positions
    QtyType:    Percent
    MaxPositions:    positions
    EntrySetup:    EndOfMonth and  canhold and posrank <= positions
    EntryScore:    roc63
    ExitRule:    EndOfMonth and (posrank > worstrank or not canhold)

View attachment 150720
View attachment 150723

View attachment 150721
Impressive, thanks for posting.

How does it go on the ASX 20, 100, 200, All Ords, entire market with say turnover of $40mill/month?
 
Hi all,

I just wanted to give some follow up to this post I put up a while back.

A very kind chap sent me an private message suggesting that what I was trying to do (with difficulty!), could be done quite easily in a program called REALTEST or RT, I had not heard of it and was dubious as always... I've been using Amibroker for 10+ years now but intrigued I found the youtube channel mhp trading which demonstrates the program and I have to say... (WOW)

I'll be purchasing the software as soon as my free trial (30 days) is up...

My summary of the software is quite simple. Its Amibroker but without all the annoying stuff...
- want to backtest over current and past symbols - no worries, one line of code
- need to make sure you have no future leaks with entry prices, exit price sequence for limit orders etc - no worries, the backtest engine does that automatically
- documentation - great
- examples and tutorials - great
- support forum - had a quiery - was answered with example scripts with hours (was not belittled in the help forum - a nice change)
- backtest speed --> gives amibroker more than a run for its money.
- cost --> roughly same as amibroker for a single license.

I've attached a RT script which I think does what I was trying to do in ambroker... I'll leave it to you to decide which looks simpler!

Hope this helps... I am in no way affilliated with RT, just wanted to give this software and the developer the credit which I think is thoroughly deserved.

Horses for courses, I'll still use Amibroker and Python when they are the best suited for the job.

Cheers
C++:
Notes:    Three Ranks idea: From youtube channel
   
Import:    // assumes Platinum subscription level
    DataSource:    Norgate
    IncludeList:    .NASDAQ 100 Current & Past
    IncludeList:    SPY // for bull market indicator
    Constituency:    $NDX // include Nasdaq 100 index constituency data
    StartDate:    1/1/04
    EndDate:    Latest
    SaveAs:    ndx_rotate.rtd

Settings:    DataFile:    ndx_rotate.rtd
    StartDate:    Earliest
    EndDate:    Latest
    BarSize:    Daily
    UseAvailableBars:    False
    AccountSize:    100000
   
Data:    uptrend:    c > Avg(C,200)
    bullmkt:    Extern($SPY, uptrend)
    roc252:    ROC(C,252)
    roc126:    ROC(C,126)
    roc63:    ROC(C,63)
    canhold:    InNDX and bullmkt and C > 10 and uptrend
    rank1:    #rank (canhold * roc252)
    rank2:    #rank ((rank1 < 50) * roc126)
    rank3:    #rank ((rank2 < 25) * roc63)

    posrank:    rank3

Parameters:    positions:    10
    worstrank:    10 // set to > 10 to hold positions longer, set to 0 for monthly rebalance
   
Strategy:    ndx_rotate
    Side:    Long
    Quantity:    100 / positions
    QtyType:    Percent
    MaxPositions:    positions
    EntrySetup:    EndOfMonth and  canhold and posrank <= positions
    EntryScore:    roc63
    ExitRule:    EndOfMonth and (posrank > worstrank or not canhold)

View attachment 150720
View attachment 150723

View attachment 150721
Good Job Willzy.

I've been using RT for a number of years, I was a beta user so it has evolved ALOT since it went live. Feel free to post in this thread to spread the word about the awesome piece of software.

 
Good Job Willzy.

I've been using RT for a number of years, I was a beta user so it has evolved ALOT since it went live. Feel free to post in this thread to spread the word about the awesome piece of software.

all my legacy and knowledge is with AB but all I ever read about RT is flattering..I need to bite the bullet and give it a fair go.
If I wait..to have time, I will never do it
 
Impressive, thanks for posting.

How does it go on the ASX 20, 100, 200, All Ords, entire market with say turnover of $40mill/month?

Hi Gringotts, I wasnt sure how to set the max turnover to 40mil/month.... (I'll keep searching) here are the results for the ASX100 200 and 300, surprisingly the 300 was best.

Very early days for me with RT but I don't think I've made any shocking errors!
 

Attachments

  • Test 6 - threeRanks_ASX_200.pdf
    635.1 KB · Views: 22
  • Test 7 - threeRanks_ASX_100.pdf
    643.5 KB · Views: 13
  • Test 9 - threeRanks_ASX_300.pdf
    645.3 KB · Views: 30
Hi Gringotts, I wasnt sure how to set the max turnover to 40mil/month.... (I'll keep searching) here are the results for the ASX100 200 and 300, surprisingly the 300 was best.

Very early days for me with RT but I don't think I've made any shocking errors!
Very nice presentation. Thanks for sharing the code with us.

Is survivorship accounted for? Was there any optimization used?
 
Very nice presentation. Thanks for sharing the code with us.

Is survivorship accounted for? Was there any optimization used?
Survivorship bias is accounted for.

See the lines
- inIndex: inXJO
- ASX current and past etc

I played around with the indexFilter period - 75 was the best, and I also played with numPositions and worstRankHeld, check the code at the bottom of each report to see what I used for each.

I was just playing with the concept and trying to learn a bit of RT whilst at it.

This isnt tradeable for me in its current form. Whilst there were some good results the average CARMDD was pretty stable around 0.5, to assume more than that from this system would be curve fitting/data mining.

I do like the concept of ranking and sorting multiple times, I'll play around with volatilityScores ie C/ATR or something similar in the sorting to see if I can find a better edge.

Cheers!
 
Interest Rates & Debt
Self-responsible & personal accountability for the choices we make form the solution.

View attachment 150748

Skate.
Skate this latest post is so true. It is something the late scumbag Alan Bond told me many years ago when I was working on his daughter's place in Brigadoon. Never borrow a peanut, always go for a bag full and let the lender have the headache
 
This isnt tradeable for me in its current form.

Willzy, thanks for the backtest results. I wouldn't look for a better edge. The one you've got right there is quite impressive already.

But here are some troubling concerns:
- most of the profit happened before 2010
- 2003-2007 was the "genius-maker-market" when anything would have worked
- notice that the entire gains in 2008 came in one month, May, and the system was conveniently out of the market the rest of the year. You might say that the index filter kept you out but the XJO was decisively below the 200-day MA during all of 2008 and until June 2009
- the Sharpe Ratio is suspiciously high (the drawdowns are unbelievably low)

Other than that, there are no obvious red flags. The returns since 2010 are plausible, just that I would expect much bigger drawdowns.

Is it even possible that such a simple and obvious scheme could produce double the buy-and-hold returns with a fraction of the drawdown?

Let's assume that it works. A position size of $20,000 for ASX100 stocks would be appropriate with minimal market impact. This requires a $200,000 portfolio.
Now, it would be reasonable to expect the rebalancing to work not only on the last day of each month but on the first and the second, the third, etc., any of the 21 trading days. It would be a very bad sign if it didn't.
So, we could manage 21 tranches of $200,000 making a $4,200,000 portfolio,
Not only that, but we don't have to only trade at the Open or the Close; why not every hour? Even every 15 minutes. Why not? Liquidity shouldn't be too much of an issue as we invest in ASX100 stocks only.
It's going to be a full-time-job but we could manage a $50 million or even a $200 million portfolio.

Why hasn't anyone thought of this?

Oh, I know, they haven't got $200,000,000. Of course.

BTW, do you know about the MarketIndex Top 5 system? Maybe that was your inspiration. Worth checking out.

 
Willzy, thanks for the backtest results. I wouldn't look for a better edge. The one you've got right there is quite impressive already.

But here are some troubling concerns:
- most of the profit happened before 2010
- 2003-2007 was the "genius-maker-market" when anything would have worked
- notice that the entire gains in 2008 came in one month, May, and the system was conveniently out of the market the rest of the year. You might say that the index filter kept you out but the XJO was decisively below the 200-day MA during all of 2008 and until June 2009
- the Sharpe Ratio is suspiciously high (the drawdowns are unbelievably low)

Other than that, there are no obvious red flags. The returns since 2010 are plausible, just that I would expect much bigger drawdowns.

Is it even possible that such a simple and obvious scheme could produce double the buy-and-hold returns with a fraction of the drawdown?

Let's assume that it works. A position size of $20,000 for ASX100 stocks would be appropriate with minimal market impact. This requires a $200,000 portfolio.
Now, it would be reasonable to expect the rebalancing to work not only on the last day of each month but on the first and the second, the third, etc., any of the 21 trading days. It would be a very bad sign if it didn't.
So, we could manage 21 tranches of $200,000 making a $4,200,000 portfolio,
Not only that, but we don't have to only trade at the Open or the Close; why not every hour? Even every 15 minutes. Why not? Liquidity shouldn't be too much of an issue as we invest in ASX100 stocks only.
It's going to be a full-time-job but we could manage a $50 million or even a $200 million portfolio.

Why hasn't anyone thought of this?

Oh, I know, they haven't got $200,000,000. Of course.

BTW, do you know about the MarketIndex Top 5 system? Maybe that was your inspiration. Worth checking out.


I added the following line
Allocation: S.StartEquity
this basically means only calculate position size based on the initial equity. So in this case it is 10% of $100,000 for every new position. Like I said these things are so easy in real test.
1671597789084.png

1671598020766.png

It is actually interesting how much of the edge disappears if you test entering or exiting on any day besides the first day of the month in these systems

Also as you have pointed out there is a lot of luck involved, such as when an index filter will take it in or out of the market. Why it is important to test a number of variables on these major parts of the system.
 
Top