Australian (ASX) Stock Market Forum

Dump it Here

MAfilter = MA( C, 10 ); // 10 week lookback period
IndexBuyFilter = C > MAfilter; // Index Filter = ON: When the close is greater than the 10 week simple moving average the Index Filter is ON [trailing stop set to 20%] + [buy + sell signals generated]
IndexSellFilter = C < MAfilter; // Index Filter = OFF: When the close is less than the 10 week simple moving average the Index Filter is OFF [shortens trailing stop to 10%] + [only sell signals generated]

I may be missing something, but it doesn't look like your code for the index filter is actually referencing the index, rather just the individual symbol??

I am by no means an Amibroker expert so if I am missing it somewhere please let me know.
 
I think you may be right as those calcuations came after:

RestorePriceArrays( True );

I'm pretty sure those calcs have to be done before you restore the arrays to the default symbol?
 
Maybe something like this

IndexCode = ParamStr("Index Symbol","$XAO.au");
Index = Foreign(IndexCode,"C");
MAFilter = MA( C, 10);
IndexBuyFilter = Index > MAFilter;
IndexSellFilter = Index < MAFilter;
RestorePriceArrays( True );
 
I think you may be right as those calcuations came after:

RestorePriceArrays( True );

I'm pretty sure those calcs have to be done before you restore the arrays to the default symbol?

Maybe something like this

IndexCode = ParamStr("Index Symbol","$XAO.au");
Index = Foreign(IndexCode,"C");
MAFilter = MA( C, 10);
IndexBuyFilter = Index > MAFilter;
IndexSellFilter = Index < MAFilter;
RestorePriceArrays( True );

@Warr87, to my eye I think you are correct. I've made the following change

Code:
//2. The "Index Filter" - decides when we will trade & also our trailing stop levels
//=================================================================================
SetForeign( "$XAO.au", True , True ); // I've used the new Norgate Updater (NDU) format - change if the format is different to your data supplier
MAfilter = MA( C, 10 ); // 10 week lookback period
IndexBuyFilter = C > MAfilter; // Index Filter = ON: When the close is greater than the 10 week simple moving average the Index Filter is ON [trailing stop set to 20%] + [buy + sell signals generated]
IndexSellFilter = C < MAfilter; // Index Filter = OFF: When the close is less than the 10 week simple moving average the Index Filter is OFF [shortens trailing stop to 10%] + [only sell signals generated]
RestorePriceArrays( True ); // Restores original price and volume arrays after the call to SetForeign.
 
As to your WTT I have run a series of backtests to see particular statistics over different time frames. Hopefully they will be of interest

I've just looked at the data that I use with Norgate and have clarified a misconception. My subscription level with Norgate does NOT include all historical movements, as such the data I have submitted will not be correct. Sorry for anyone being misled here.

As has been commented before on backtests - care needs to be taken :oops:
 
I may be missing something, but it doesn't look like your code for the index filter is actually referencing the index, rather just the individual symbol?? I am by no means an Amibroker expert so if I am missing it somewhere please let me know.
apology download.png
The original code
@WilsonFisk you are correct the "BUYFilter" references individual positions & not an Index. To keep the version as is - you can change "Index" to "Buy" as it makes no difference running the code - The terminology (Index) got through to the keeper. Sorry about that. If you prefer (a) you can substitute an Index Filter, (b) remove the Buy Filter (c) reword "Index to Buy" or (d) leave the strategy as is "as it makes no difference when running the strategy".

The Index Filter is really a Buy Filter (terminology corrected)
Everywhere Index is written you can change Index to Buy as the example below displays

//=================================================================================
//2. The "Buy Filter" - decides when we will trade & also our trailing stop levels
//=================================================================================
MAfilter = MA( C, 10 ); // 10 week lookback period
BuyFilter = C > MAfilter; // Buy Filter = ON: When the close is greater than the 10 week simple moving average the Buy Filter is ON [trailing stop set to 20%] + [buy + sell signals generated]
SellFilter = C < MAfilter; // Buy Filter = OFF: When the close is less than the 10 week simple moving average the Buy Filter is OFF [shortens trailing stop to 10%] + [only sell signals generated]

Skate.
 
@Skate you've inspired me to start a trial of Norgate and Amibroker. I've started running a few simple backtests, pretty straight forward. The code that you have shared will give me a LOT to chew on, as I want to understand every line.

At the same time, I'm researching strategies and generally educating myself...so my hope is to learn a strategy/system, then code it as a way to learn both the strategy and Amibroker.
 
@Skate you've inspired me to start a trial of Norgate and Amibroker. I've started running a few simple backtests, pretty straight forward. The code that you have shared will give me a LOT to chew on, as I want to understand every line. At the same time, I'm researching strategies and generally educating myself...so my hope is to learn a strategy/system, then code it as a way to learn both the strategy and Amibroker.

@TraderJimmy, thank you for your kind words, they are appreciated.

Hint
If you do a search I have uploaded a few different strategies that may help you understand a strategy a little better.

Skate.
 
Hint
If you do a search I have uploaded a few different strategies that may help you understand a strategy a little better.

Make sure you include a search around psychology/behaviour as part of that, as you need to have a strategy for how you will act whilst implementing the trading strategy.

Knowing how you will behave when the market or a trade moves against you, will do wonders for constructing a system as it will give you a baseline of what you are working towards.
 
Make sure you include a search around psychology/behaviour as part of that, as you need to have a strategy for how you will act whilst implementing the trading strategy. Knowing how you will behave when the market or a trade moves against you, will do wonders for constructing a system as it will give you a baseline of what you are working towards.

@WilsonFisk you nailed it.

That's a two thumbs up type of post.

Smiley 2 thumbs.JPG
Skate.
 
'Trading in the Zone' is a great book for that. The recent COVID crash provides a good learning opportunity for people. Would you actually keep trading if you saw 20-48% of your money evaporate in a paniced market? If you say you can stomache -25% drawdown, is that actually the case? Losing $25,000 out of a $100,000 isn't easy to stomache.

Good luck with the coding @TraderJimmy . It's addictive. I spend too much time trying to code then actually doing some other work I should be doing. Make sure you check out @trav's post on amibroker and backtesting as well. Google and the AB forum are you friend too. I dare say you will quickly go from the trial of Norgate to an actual subscription too. I tried going for free, and even paid for Amiquote. But quickly abandoned that and went for Norgate. In hindsight maybe I should have saved the $100 for AQ and put it towards Norgate. Oh well, lesson learned. (AQ is a good product btw but quality data is a must.)

@Skate I recently finished some final touches for a daily system and actually removed the index filter based on a suggested from a member here. My system performs much better without it, and barely lost anything in the COVID crash. But since it is designed to buy into pullbacks the index filter was making my DD worse by removing opportunities to recover. Index filter isn't always your friend! Though I recommend it in 90% of cases.
 
View attachment 107483
The original code
@WilsonFisk you are correct the "BUYFilter" references individual positions & not an Index. To keep the version as is - you can change "Index" to "Buy" as it makes no difference running the code - The terminology (Index) got through to the keeper. Sorry about that. If you prefer (a) you can substitute an Index Filter, (b) remove the Buy Filter (c) reword "Index to Buy" or (d) leave the strategy as is "as it makes no difference when running the strategy".

The Index Filter is really a Buy Filter (terminology corrected)
Everywhere Index is written you can change Index to Buy as the example below displays

//=================================================================================
//2. The "Buy Filter" - decides when we will trade & also our trailing stop levels
//=================================================================================
MAfilter = MA( C, 10 ); // 10 week lookback period
BuyFilter = C > MAfilter; // Buy Filter = ON: When the close is greater than the 10 week simple moving average the Buy Filter is ON [trailing stop set to 20%] + [buy + sell signals generated]
SellFilter = C < MAfilter; // Buy Filter = OFF: When the close is less than the 10 week simple moving average the Buy Filter is OFF [shortens trailing stop to 10%] + [only sell signals generated]

Skate.
Hi would this work?

IndexCode = ParamStr( " Index Code ", " xao " );
MAfilter = Foreign( IndexCode, "C" );
 
WTT Final images.jpg

I didn't realise the amount of interest in the WTT Strategy
I had planned to make a few posts about the "WTT Strategy" & move on. The modified "WTT Strategy" I uploaded for others to evaluate isn't too shabby for a Model "T". The backtest results have inspired me to code a "Tesla model" for myself. Actually the backtest results don't look too bad for 453 lines of code. I have this grand idea that more lines of code finesses a strategy rather than bloating it, but in this case, the amount of coding is irrelevant.

Long Story short
With the interest in the "WTT Strategy" I'm planning to paper trade it alongside the "HappyCat v1 Strategy" with the same start period. The "HappyCat v2 Strategy" now gets the flick.

Portfolio Configuration includes
The strategy will be a 20-period Breakout strategy
1. A 10 period Index Filter
2. A Price filter
3. A Turnover Filter
4. A Volume Filter
5. There are 2 Momentum exits (SMA & ROC) & a two-stage "Looping" Trailing Stop (40% & 10%)

Reporting will be on Fridays
I'll post the "WTT Strategy" results at the same time & in the same vein as the "HappyCat Strategy" meaning all the weekly signals will be displayed for both strategies with the weekly reports. To kick off the reporting I have the trading results that are up-to-date as of the end of trade today that I will post shortly.

Skate.
 
WTT Final images.jpg

@Skate , Nick Radge has posted his current positions as at 10 August 2020 on his Twitter feed. As a cross check on coding you could see what positions your WTT coded portfolio held against those in Nick's. I will have a look tomorrow, at first glance I'm thinking my coding is only a 60% MATCH o_O Here is a link to his post https://t.co/tKhbff8VEX

@CNHTractor thanks for the link to Nick's Twitter feed as it gives me the opportunity to check my "Tesla" WTT Strategy benchmarking if the signals align.

The Chartist Capture.JPG

There is a minor difference
Nick's WTT Strategy exits on the "Trail Stop" levels whereas I have added two additional exits to my strategy being both "Momentum" exits (SMA & ROC). I also have the two-stage "Looping" Trailing Stop (40% & 10%) the same as the original code.

When the signals align (100%) I have circled the buy position
As I have two extra momentum I'll exit a little sooner at times. After exiting there maybe a re-entry at a later date.

The Chartist Buy Position
1. WAF - The Chartist Capture.jpg
1. WAF Capture.JPG



The Chartist Buy Position
2. SWF - The Chartist Capture.jpg
2. SWF Capture.JPG




The Chartist Buy Position
3. CTM - The Chartist Capture.jpg
3. CTM Capture.JPG



The Chartist Buy Position
4. RMS - The Chartist Capture.jpg
4. RMS Capture.JPG



more coming soon download.png

Upload Limit reached

Skate.
 
WTT Final images.jpg

There is a minor difference
Nick's WTT Strategy exits on the "Trail Stop" levels whereas I have added two additional exits to my strategy being both "Momentum" exits (SMA & ROC). I also have the two-stage "Looping" Trailing Stop (40% & 10%) the same as the original code.

When the signals align (100%) I have circled the buy position
As I have two extra momentum I'll exit a little sooner at times. After exiting there maybe a re-entry at a later date.

The Chartist Capture.JPG

The Chartist Buy Position
5. SLR - The Chartist Capture.jpg
5. SLR Capture.JPG



The Chartist Buy Position
6. ABR - The Chartist Capture.jpg

6. ABR Capture.JPG




The Chartist Buy Position
7. CAI - The Chartist Capture.jpg
7. CAI Capture.JPG




The Chartist Buy Position
8. CEL - The Chartist Capture.jpg
8. CEL Capture.JPG

more coming soon download.png

Skate.
 
WTT Final images.jpg

There is a minor difference
Nick's WTT Strategy exits on the "Trail Stop" levels whereas I have added two additional exits to my strategy being both "Momentum" exits (SMA & ROC). I also have the two-stage "Looping" Trailing Stop (40% & 10%) the same as the original code.

When the signals align (100%) I have circled the buy position
As I have two extra momentum I'll exit a little sooner at times. After exiting there maybe a re-entry at a later date.

The Chartist Capture.JPG

The Chartist Buy Position
9. E25 - The Chartist Capture.jpg

9. E25 Capture.JPG



The Chartist Buy Position
10. EMV - The Chartist Capture.jpg
10. EMV Capture.JPG



The Chartist Buy Position
11. MGV - The Chartist Capture.jpg
11. MGV Capture.JPG


Summary

The charts confirm that my version of "WTT STrategy" is pretty close to the original.

As they say
"Sometimes good enough is good enough"

END.

Skate.
 

Attachments

  • 9. E25 Capture.JPG
    9. E25 Capture.JPG
    105.3 KB · Views: 35
Top