Home › Forums › Trading System Mentor Course Community › Progress Journal › Glen’s Journal
- This topic is empty.
-
AuthorPosts
-
December 1, 2021 at 5:00 am #114081DeanWaltonMember
Code resend. Hopefully this will produce no error messages. This is abridged version of the code i sent before. Thanks for your patience.
#include_once “FormulasNorgate DataNorgate Data Functions.afl”
SetBarsRequired(sbrAll,0);
_SECTION_BEGIN (“Index Filter”);
//=================================================================================
//Index Filter
//=================================================================================
IndexSwitch = ParamToggle(“Index Filter”,”On|Off”,0);
//IndexCode = ParamStr(“Index Code”,”$XSO.au”);//$XAO.au for ASX
SetForeign(“$XsO.au”);//(“$XAO.au”)//Super trend
IndATR_Multiplier= Param(“ATR Multiplier”,3.5,3.5,5,0.25);
IndATR_Period= Param(“ATR Period”,30,10,30,5);getATR=ATR(IndATR_Period);
basic_UpperBand=0;
basic_LowerBand=0;
final_UpperBand=0;
final_LowerBand=0;
superTrend=0;//Super Trend Calculations
for( i = IndATR_Period; i < BarCount; i++ )
{
basic_UpperBand(High + Low)/2) + IndATR_Multiplier*getATR;
basic_LowerBand(High + Low)/2) – IndATR_Multiplier*getATR;
final_UpperBand = Iif( ((basic_UpperBandfinal_UpperBand[i-1])), (basic_UpperBand ), final_UpperBand[i-1] );
final_LowerBand = Iif( ((basic_LowerBand>final_LowerBand[i-1]) OR (Close[i-1]), final_LowerBand[i-1] ); superTrend = superTrend = Iif((((superTrend[i-1])==(final_UpperBand[i-1])) AND ((Close)<=(final_UpperBand))),(final_UpperBand),Iif((((superTrend[i-1])==(final_UpperBand[i-1])) AND ((Close)>=(final_UpperBand))),(final_LowerBand),Iif((((superTrend[i-1])==(final_LowerBand[i-1])) AND ((Close)>=(final_LowerBand))),(final_LowerBand),Iif((((superTrend[i-1])==(final_LowerBand[i-1])) AND ((Close)<=(final_LowerBand))),(final_UpperBand),0))));
}
IndexFilterUp = C > SuperTrend;
IndexFilterDn = C < SuperTrend;
IndexFilter = IIf(IndexSwitch,1,IndexFilterUp);
RestorePriceArrays();//=================================================================================
_SECTION_END();_SECTION_BEGIN(“Historical Data Base Testing”);
//=================================================================================
//Historical Data Base Testing
//=================================================================================
ASXList = ParamList(“ASX Historical Watchlist:”,”1: Off|2: ASX 20|3: ASX 50|4: ASX 100|5: ASX 200|6: ASX 300|7: ASX All Ordinaries|8: ASX Small Ordinaries|9: ASX Emerging Companies|10: Excluding ASX 300|11: In XAO but Exc ASX 100|12: Exc XAO”,0);HistDB = 1;
if(ASXList == “1: Off”) HistDB = 1;
if(ASXList == “2: ASX 20”) HistDB = NorgateIndexConstituentTimeSeries(“$XTL”);
if(ASXList == “3: ASX 50”) HistDB = NorgateIndexConstituentTimeSeries(“$XFL”);
if(ASXList == “4: ASX 100”) HistDB = NorgateIndexConstituentTimeSeries(“$XTO”);
if(ASXList == “5: ASX 200”) HistDB = NorgateIndexConstituentTimeSeries(“$XJO”);
if(ASXList == “6: ASX 300”) HistDB = NorgateIndexConstituentTimeSeries(“$XKO”);
if(ASXList == “7: ASX All Ordinaries”) HistDB = NorgateIndexConstituentTimeSeries(“$XAO”);
if(ASXList == “8: ASX Small Ordinaries”) HistDB = NorgateIndexConstituentTimeSeries(“$XKO”) AND NOT NorgateIndexConstituentTimeSeries(“$XTO”);
if(ASXList == “9: ASX Emerging Companies”) HistDB = NorgateIndexConstituentTimeSeries(“$XEC”);
if(ASXList == “10: Excluding ASX 300”) HistDB = NorgateIndexConstituentTimeSeries(“$XKO”)==0;
if(ASXList == “11: In XAO but Exc ASX 100”) HistDB = NorgateIndexConstituentTimeSeries(“$XAO”) AND NOT NorgateIndexConstituentTimeSeries(“$XTO”);
if(ASXList == “12: Exc XAO”) HistDB = NorgateIndexConstituentTimeSeries(“$XAO”)==0;//=================================================================================
_SECTION_END();_SECTION_BEGIN (“Optional Price & Volume Filters”);
//=================================================================================
//Optional Price & Volume Filters
//=================================================================================
CloseToggle = ParamToggle(“Close Price”,”Adjusted|Unadjusted”,1);
CloseArray = IIf(CloseToggle,NorgateOriginalCloseTimeSeries(),Close);VolumeToggle = ParamToggle(“Volume”,”Adjusted|Unadjusted”,1);
VolumeArray = IIf(VolumeToggle,NorgateOriginalVolumeTimeSeries(),Volume);
//
PriceTog = ParamToggle(“Price Filter”,”Off|On”,1);
MinSP = Param(“Minimum Share Price – $”,0.50,0,1,.1);
MaxSP = Param(“Maximum Share Price – $”,5,5,20,1);
MinMaxSP = CloseArray >= MinSP AND CloseArray <= MaxSP;
PriceFilt = IIf(PriceTog,MinMaxSP,1);
//
TOTog = ParamToggle(“Turnover Filter”,”Off|On”,1);
MinTO = Param(“Minimum Turnover – $”,400000,150000,1000000,50000);
AverageVolume = EMA(VolumeArray,Param(“VolMA”,20,5,30,5));
TOFilter = (CloseArray * AverageVolume) > MinTO;
TOFilt = IIf(TOTog,TOFilter,1);//
VolTog = ParamToggle(“Volume Filter”,”Off|On”,0);
MinVol = Param(“Minimum Volume”,300000,0,10000000,1000);
VolFilter = VolumeArray > MinVol;
VolFilt = IIf(VolTog,VolFilter,1);
//
AveVolTog = ParamToggle(“Average Volume Filter”,”Off|On”,0);
MinAveVol = Param(“Minimum Average Volume”,500000,0,10000000,1000);
AVPer = Param(“Volume EMA”,10,1,200,1);
AveVol = EMA(VolumeArray,AVPer) > MinAveVol;
AveVolFilt = IIf(AveVolTog,AveVol,1);
//
OptFilt = PriceFilt AND TOFilt AND VolFilt AND AveVolFilt;
//=================================================================================
_SECTION_END();_SECTION_BEGIN (“System Parameters”);
//=================================================================================
//Parameters
//=================================================================================//ROC Lookback x 1
ROCLookBack = Param(“ROCLookBack”,125,50,300,5);
MyROC = ROC(Close,ROCLookBack);
ROCLB = MyROC;//ROC Lookback x 2
ROCLB1 = Param(“ROCLookBack1”,60,10,100,10);
MyROCLB1 = ROC(Close,ROCLB1);
ROCLB2 = PAram(“ROCLookBack2”,110,100,200,10);
MyROCLB2 = ROC(Close,ROCLB2);
ROCFinal1 = MyROCLB1 + MyROCLB2;//=================================================================================
//Entry & Exit
//=================================================================================
Rank = ROCFinal1;
Cond1 = Rank > Optimize(“RankVal”,50,0,150,5);OnLastTwoBarsOfDelistedSecurity = BarIndex() >= (LastValue(BarIndex()) -1) AND !IsNull(GetFnData(“DelistingDate”));
LESetup = Cond1 AND IndexFilter AND HistDB AND OptFilt; //Any additional buy rules apart from the rotational criteria – e.g index, price filters etc
LE = Ref(LESetUp,-1) AND NOT OnLastTwoBarsOfDelistedSecurity;//=================================================================================
_SECTION_END();_SECTION_BEGIN (“Backtesting Options”);
//=================================================================================
//Backtesting Parameters
//=================================================================================
posqty = Param(“# Positions”,5,10,10,5);
Eq = Param(“Initial Equity”,100000,1,10000000,1);
SetOption(“InitialEquity”,Eq);
SetOption(“MaxOpenPositions”,posqty);
SetOption(“UsePrevBarEquityForPosSizing”,True);
SetOption(“AccountMargin”,100);
SetTradeDelays(0,0,0,0);SetBacktestMode(backtestRotational);
EOM = Month() != Ref(Month(),-1);//First trading day of the month
score = Ref(Rank,-1);//score is the rotational criteria
Score = IIf(LE,score,0);
PositionScore = IIf(Year()>=1985 AND EOM,Score,scoreNoRotate);MinRank = Param(“Min Rank”,11,6,20,1);
SetOption(“WorstRankHeld”,MinRank);
//
SetPositionSize(100/posqty,spsPercentOfEquity);//=================================================================================
_SECTION_END();_SECTION_BEGIN (“Exploration”);
//=================================================================================
//Exploration
//=================================================================================
Filter = LESetup;AddColumn(Rank,”Rank”,1.4);
//=================================================================================
_SECTION_END();December 1, 2021 at 7:55 am #114119GlenPeakeParticipantDean Walton wrote:_SECTION_BEGIN (“Index Filter”);
//=================================================================================
//Index Filter
//=================================================================================
IndexSwitch = ParamToggle(“Index Filter”,“On|Off”,0);
//IndexCode = ParamStr(“Index Code”,”$XSO.au”);//$XAO.au for ASX
SetForeign(“$XsO.au”);//(“$XAO.au”)The copy/paste from the forum was/is messing around with some of the code…. so if you can attach it as a file or use the code snippet within the forum, that’d be better
e.gCode:IndexSwitch = ParamToggle(“Index Filter”,”On|Off”,0);Just on the above line, you have the IndexSwitch option turned OFF. So when I ran the code in a backtest, it didn’t return anything…. so I corrected the switch and then ran another backtest….. the results were nothing like you posted in the backtest report above……? I.e. completely different…. the Index Filter didn’t appear to be reverting to cash during market selloffs…. i.e. 2008 GFC / 2020 COVID etc
Like we’re talking different code versions etc… I was looking at DD of -50%…. The code you posted might be an earlier version of your system etc…..
The version of code you posted up, still has price/turnover filter ON etc…. Not sure if this is what your code is currently configured as.
At any rate…. my earlier suggestions are still valid… just gotta keep testing different options etc…. Looking at your WIN % from your report…. you’re getting 56% which is the same as mine, so you’re in the ballpark… etc… just think of a way to ‘weed out’ / identify some of the ‘weaker’ momentum stocks e.g. recent gaps down….or identify/target some of the stronger MOMO stocks e.g. increasing RSI…. or similar etc
December 1, 2021 at 9:37 am #114125DeanWaltonMemberWill try some more tomorrow. I tried RSI and using highs and closes greater than they were x days ago. Neither added anything. Will check index code. The results were from diff test with slightly different parameters I was playing with today to see how it compared to your suggestion from 1998-2021. I’ll sleep on it and hope something hits me. Thanks.
December 2, 2021 at 6:20 am #114112SteveWallbrinkMemberGlen Peake wrote:Thanks Steve…. There’s enough liquidity on the OPEN auction to get my fills on XSO & ASX100…..If a stock has low liquidity, then as it is a monthly system you could space out your orders over the day etc…. but I haven’t had an issue as yet.
Thanks for the update Glen.
So you don’t use any price volume or liquidity filters – even on the XSO?
Doesn’t this risk shallow market depth and possibility of gaps down when selling – particularly in any scale of market correction?December 2, 2021 at 7:25 am #114143GlenPeakeParticipantHi Steve,
Nah, no price/volume/liquidity filters. From my testing/research on the XSO system, these stocks with strong momentum general attract a lot of turnover (as they are going up etc),
Here are the Stocks I entered into last month for the XSO system … you can see the daily turnover for each stock on 1/11/2021 when I entered the positions.
These aren’t the ‘penny dreadful’, low liquidity stocks I’m trading etc
The lowest turnover for the day was $HMC.au with $1.4mil… and considering the OPEN is typically where most of the volume is done, this is sufficient for my BUYs (and SELLs). I think most here when they design a system with a turnover filter, ‘generally’ select or at least default to starting with a $1,000,000 Turnover Filter etc…. So in the $HMC.au trade above, it had $1.4mil turnover on the day I bought it, so all good…. the other stocks had even more turnover etc….
I guess if you had a large amount of capital allocated to the system, then it might warrant some sort of liquidity filter or scale in/out order flow process, but for me, all is OK.
Let me know if you have any more questions…. happy to answer them.
January 1, 2022 at 3:13 am #114144GlenPeakeParticipantDECEMBER 2021
ASX
WTT -2.81% (Since Go Live in JAN 2019: +39.03%)
ASX100 RTN +15.58%XSO RTN -10.18%
US
MR#1 +2.04%
MR#2 +6.15%
MR#3 -2.99%
MR#4 -6.88%
MR#5 -0.45%NDX100 RTN -9.66%
R1000 RTN +0.27%Total Account: -3.08%
2021 was a year of under performance. December started off down -10% for the total account, manged to find a ‘shovel’ and dig my way out of a chunk of the hole.
I added 5 systems to the suite of systems during 2021.
In general the R1000 RTN system was the best performer, which launched mid-year, returned +24% during that time, next best was the NDX100 RTN with +18%, not much doing for the Mean Reversion systems or the ASX100 RTN system this year and the WTT returned a meager +7%.
February 1, 2022 at 3:30 am #114247GlenPeakeParticipantJANUARY 2022
ASX
WTT -4.5% (Since Go Live in JAN 2019: +32.77%)
ASX100 RTN +1.62% (System went to 100% cash @ the start of the month)XSO RTN +1.56% (System went to 100% cash @ the start of the month)
US
MR#1 -13.63%
MR#2 -22.67%
MR#3 -9.30%
MR#4 -13.70%
MR#5 -9.47%NDX100 RTN -22.38%
R1000 RTN -9.16%Total Account: -6.84%
I got a little lucky with both of the ASX100 & XSO monthly rotational systems. Both Index Filters turned RED and went to cash on an uptick day @ the start of January…. If the Index Filters had stayed green, ASX100 RTN would’ve been down circa -9% and the XSO RTN circa -20%.
The WTT is currently in defensive mode holding just 2 positions. The WTT was up circa +9% earlier in the month…. mainly due to $BRN…
All things considered, the total account return is not as bad as I thought it was going to be.
March 1, 2022 at 4:47 am #114355GlenPeakeParticipantFEBRUARY 2022
ASX
WTT +0.12% (Since Go Live in JAN 2019: +32.93%)
ASX100 RTN +0.00% (System in 100% cash)XSO RTN +0.00% (System in 100% cash)
US
MR#1 +0.71%
MR#2 +3.97%
MR#3 +4.10%
MR#4 -8.99%
MR#5 -4.36%NDX100 RTN +2.38% (System went to 100% cash @ the start of the month)
R1000 RTN -5.09%Total Account: -0.82%
The WTT is holding just 1 position atm. The R1000 Monthly Rotational will go to 100% cash tonight, which means all Rotational systems will be sitting on the sidelines in cash.
March 31, 2022 at 11:43 pm #114453GlenPeakeParticipant
MARCH 2022ASX
WTT +3.29% (Since Go Live in JAN 2019: +37.30%)
ASX100 RTN +0.00% (System in 100% cash)XSO RTN +0.00% (System in 100% cash)
US
MR#1 +3.28%
MR#2 +5.28%
MR#3 +7.83%
MR#4 -0.82%
MR#5 -0.58%NDX100 RTN +0.00%
R1000 RTN +0.00%Total Account: +1.47%
The WTT system ‘woke up’ again in the 2nd half of the month and is now 100% invested.
All Monthly momo rotational systems (except the ASX100 RTN) will go from 100% cash, to 100% invested for April. The ASX100 went within a whisker of going green but will sit APRIL out on the sidelines.Overall a bit of a ‘reset’ month… after the previous few months of volatility.
April 30, 2022 at 4:03 am #114607GlenPeakeParticipantAPRIL 2022
ASX
WTT +1.61% (Since Go Live in JAN 2019: +39.51%)
ASX100 RTN +0.00% (System in 100% cash)XSO RTN +4.38%
US
MR#1 -9.02%
MR#2 -7.73%
MR#3 -9.79%
MR#4 -19.84%
MR#5 -22.06%NDX100 RTN -14.69%
R1000 RTN -9.77%Total Account: -4.11%
Current Total Account drawdown: -12.86% (Of that, -10.09% is for 2022 year to date).
After reading some of Nick’s comments in his newsletter/market commentary around “US equities have had the worst start to the year since 1988, and the third worst in history.” It’s a reminder that it’s tough going in the markets atm. I think my current drawdown is not too bad and very stomachable and what’s important is that I can keep pulling the trigger/pushingbuttons on my trades.
The MR#4/MR#5 systems trade in the R2000/R3000 universe, so that’s behind the ‘sizeable’ negative returns.
The XSO RTN system was up around +13% for the month, before the volatility kicked in.
Index Filters for the ASX100 & XSO monthly RTN systems is green for the month of MAY. So I’ll begin MAY being 100% invested in all the ASX systems i.e. WTT, ASX100 & XSO systems.
June 1, 2022 at 8:19 am #114701GlenPeakeParticipantMAY 2022
ASX
WTT -8.87% (Since Go Live in JAN 2019: +27.13%)
ASX100 RTN +2.35%XSO RTN -7.42%
US
MR#1 +8.41%
MR#2 +13.58%
MR#3 -3.33%
MR#4 +2.88%
MR#5 +3.34%NDX100 RTN 0%
R1000 RTN 0%Total Account: -3.69%
Currently stuck holding a position in $AVZ.au in the WTT portfolio, I had a SELL order in the market on the Monday that in went into a trading halt/suspension and am still stuck holding it. Judging from today’s news release, looks like it will continue to be suspended for another month
The Mean Reversion systems made a bit of a comback this month, we’ll see if that continues into the coming months.
Both ASX100 and XSO systems will be sitting in cash for the month of June.
June 1, 2022 at 3:25 pm #114804LEONARDZIRParticipantJulian, nice results in US.
LenJune 1, 2022 at 3:34 pm #114807LEONARDZIRParticipantSorry Glen meant to compliment you on your MR trading.. New format for forum snagged me a bit.
LenJune 1, 2022 at 8:32 pm #114808GlenPeakeParticipantthanks Len!
June 1, 2022 at 11:13 pm #114805KateMoloneyParticipantNice work Glen
-
AuthorPosts
- You must be logged in to reply to this topic.