MikeGC

Trend Chaser v2.0

Category: Strategies By: MikeGC Created: August 20, 2016, 2:30 PM
August 20, 2016, 2:30 PM
Strategies
35 Comments
Trend Chaser v2.0

I posted “Bullish and Bearish Forex Screeners (based on 3 indicators)” about 4 months ago and had a lot of suggestions and support from @Nicolas, @Sofitech and @Doctrading to develop an automatic trading system.

Well, after a lot of testing, I have come up with the attached system.  It seems to be happier in the longer time frames viz. H4 up.  I have posted it with two variables, a and b, which are the parameters for the SuperTrend indicator.  Since this is the exit signal, it is important to optimise these variables for the instrument you plan to trade.  Then enter the results of the optimisation into the code and prepare it for automatic trading.  I suggest you test it forward first before committing real money.

I found a wonderful site for the procedures involved in creating and testing a strategy at https://trading.prorealtime.com/en/create-a-trading-system, for those of you who haven’t found it already.

I have also attached the results from 4 tests, of which the DAX was the most spectacular, with 2000% gain in about 15 weeks.  However it had the largest drawdown.

So have fun playing with this.  I look forward to your suggestions for improvements.

DEFPARAM CumulateOrders = true // Cumulating positions activated

// Indicators
COI = WEIGHTEDAVERAGE[10](ROC[14] +ROC[11])
MAC = MACDline[12,26,9](close)
STO = Stochastic[14,3](close)
ST = Supertrend[a,b]

// Conditions to enter long positions
c1 = COI > COI[1] AND COI < 0
c2 = MAC > MAC[1] AND MAC < 0
c3 = STO > 20 AND STO < 40

IF Not ShortOnMarket AND c1 AND c2 AND c3 THEN
 BUY 1 CONTRACT AT MARKET
ENDIF

// Conditions to exit long positions
c5 = close crosses over ST

IF c5 THEN
 SELL AT MARKET
ENDIF

// Conditions to enter short positions
c11 = COI < COI[1] AND COI > 0
c12 = MAC < MAC[1] AND MAC > 0
c13 = STO < 80 AND STO > 60

IF Not LongOnMarket AND c11 AND c12 AND c13 THEN
 SELLSHORT 1 CONTRACT AT MARKET
ENDIF

// Conditions to exit short positions
c15 = close crosses under ST

IF c15 THEN
 EXITSHORT AT MARKET
ENDIF

Download
Filename: Trend-Chaser-v.2.0-GBPUSD-H4-178.png
Downloads: 153
Download
Filename: Trend-Chaser-v.2.0-AUS200-H4-642.png
Downloads: 103
Download
Filename: TrendChaser-v2.0.itf
Downloads: 440
Download
Filename: Trend-Chaser-v.2.0-DAX-H4-2099-1.png
Downloads: 202
Download
Filename: Trend-Chaser-v.2.0-AUDUSD-H4-45.png
Downloads: 228
MikeGC
MikeGC Average
I am new to programming PRT but have been trading with PRT for about 6 years. It is a wonderful charting package but little assistance is provided with the coding of automatic traders....until now! Congratulations to Nicolas and the team who put this site together and to the great contributors. My wish is to complete the coding of my system, with some help, and to post it on this site for all to test and critique. It has been a great manual system for me and is quite profitable, but translating it into PRT is now the challenge.
Author’s Profile

Comments

gianpiero75
10 years ago
#

I have not optimized, I multiplied the parameters for 6 (5,8), to use them on the 4  hoursTF. and works very well in the backtest, now I'm using it in real...

MikeGC
10 years ago
#

I don't know if you have used the variables a and b to optimise the parameters for the SuperTrend.  This is their purpose and should be set for each time frame and each instrument . 

gianpiero75
10 years ago
#

sorry....now it's correct

error

ST = Supertrend[a,b]
a=17
// default 10
b=58

correct
a=17
// default 10
b=58
ST = Supertrend[a,b]

was just a question of code position

gianpiero75
10 years ago
#


Hi Mike...
I found the error. It's a stupid mistake made by me, but hard to notice ...

error ST = Supertrend[a,b] a=17 // default 10 b=58 correct ST = Supertrend[a,b] a=17 // default 10 b=58

 

MikeGC
10 years ago
#

Hi @gianpiero75,

I don't believe in changing the parameters to suit the time frame.  I believe that the parameters are universal and suit all time frames.  For instance, the parameters for the Coppock refer to the bars, so regardless of the time frame, the number of bars won't change.  Try restoring the original parameters and see if it crashes then.

Cheers,  Mike

gianpiero75
10 years ago
#

hi @MikeGC

the code is original, I just changed the parameters of the indicators in order to adapt to 4 hours TF. It crashes every new candle of 4 hours. no place orders

it crasches even in Daily TF. I dont Know where's the problem.

thanks a lot...

DEFPARAM CumulateOrders = false // Cumulating positions activated

// Indicators
COI = WEIGHTEDAVERAGE[58](ROC[81] +ROC[63])
MAC = MACDline[69,150,52](close)
STO = Stochastic[81,17](close)
ST = Supertrend[a,b]
a=17
// default 10
b=58

// Conditions to enter long positions
c1 = COI > COI[1] AND COI < 0
c2 = MAC > MAC[1] AND MAC < 0
c3 = STO > 20 AND STO < 40

IF Not ShortOnMarket AND c1 AND c2 AND c3 THEN
BUY 1 CONTRACT AT MARKET
ENDIF

// Conditions to exit long positions
c5 = close crosses over ST

IF c5 THEN
SELL AT MARKET
ENDIF

// Conditions to enter short positions
c11 = COI < COI[1] AND COI > 0
c12 = MAC < MAC[1] AND MAC > 0
c13 = STO < 80 AND STO > 60

IF Not LongOnMarket AND c11 AND c12 AND c13 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF

// Conditions to exit short positions
c15 = close crosses under ST

IF c15 THEN
EXITSHORT AT MARKET
ENDIF

 

MikeGC
10 years ago
#

Hi @Gianpiero75,

Are you using the original code?  If not, please send me a copy of the code you are using.

I have run the code on the AUDUSD and posted the results of the optimiser and backtest.  I have also started the code running in ProOrder, all without and error messages.  So please send me the code you used with details of the exact circumstances of the error so I can find the problem.  Did it occur as soon as you started ProOrder or sometime later?  Did it create any orders before the error?  Please send me a copy of the message, and any  other details you think might help.

 

gianpiero75
10 years ago
#

hi, 

I'm trying real system on my Ig account, but constantly fails with this message: the trading system was shut down because of a negative offset or zero ...how to solve it?

MikeGC
10 years ago
#

Hi @Gianpiero75,

Are you using the original code?  If not, please send me a copy of the code you are using.

 

ToGast
10 years ago
#

Hallo Mike, ich habe eine Strategie die ich Dir gerne Vorstellen möchte. Leider kann ich Dir keine Bilder senden.

Kann ich Dir eine Mail schreiben? 

Gruß Torsten. 

MikeGC
10 years ago
#

OK, Gruß, I have had your message translated. My email is mikegchampion at gmail dot com.  But I would prefer to use the forum so all can share our ideas.  You can send pictures via the forum.  If you are having troubles, go to the help section of this forum.  Looking forward to hearing from you.

MikeGC
10 years ago
#

 Hi Gruß,  I'm afraid I can only read a very little German.  Can you please repeat your comments in English?

 

 

ToGast
10 years ago
#

Thank you Mike!

ToGast
10 years ago
#


Die folgende Variable ist nicht definiert: a
Die folgende Variable ist nicht definiert: b

ST = Supertrend[a,b]

Was muss ich machen?

 

Danke!

MikeGC
10 years ago
#

Hi ToGast, I have left the variables in the code so that you can optimise them for the instrument and time-frame you will be trading.  Simply enter the variables into the proper area of the back tester.  Give a a range of 1 to 10 and b a range of 1 to 30 and optimise.  If the top of a range of either is hit, increase the range and run again.  You will need at least 50% winning trades and a reward/risk ratio of at least 2:1, with a minimum drawdown before you would run it live.

I have modified the code since posting v.2.0.  You will find it in my post Trend Chaser v.3.0 with Money Management.

I have found the best results with a stop loss of some description as the three indicators can take the wrong trade, hence my suggestion that you do not trade a system with less than 50% winning trades.

Have fun.  Please let me know how you go.

ToGast
10 years ago
#

Hi Mike, I have a strategy that I would like to introduce you. Sorry, I can not send you pictures.

Can I write you an email?

Greeting Torsten.

Nicolas
10 years ago
#

You can also open a new forum topic for this :)

ToGast
10 years ago
#

Hi Mike, I have a strategy that I would like to introduce you. Sorry, I can not send you pictures.

Can I write you an email?

Greeting Torsten.

 

MikeGC
10 years ago
#

It could be that you are trading mini contracts.  I ran the tests on full contracts.  Make sure that you are testing over the same time period.   Let me know how you go.

Mr. Bigshot
10 years ago
#

Thanks for your answer.

I'm new on trading. I really don't know what you mean :) But I tested on Germany 30 cach mini 1 euro.

/Morgan

Mr. Bigshot
10 years ago
#

Hello! 

Can someone please tell me why back testing DAX 4 h with the same data gives different results ?

I use Pro Real Time  

Thanks -Morgan

Nicolas
10 years ago
#

You are probably testing this strategy on Futures contracts, not CFDs ones.

MikeGC
10 years ago
#

Traders, I have managed to incorporate the money management code with the Trend Chaser code with excellent results.  I'll start a new thread with Trend Chaser v.3.0 with Money Management.  Many thanks to all assistants and inspirers. 

Elsborgtrading
10 years ago
#

Hi Mike. Yes that was excatly my thought as well, that the cfta strategy proberly would do some good here:-) I will follow your progression. *thumbs-up*

MikeGC
10 years ago
#

Many thanks, Elsborgtrading, for your comments.  The draw down is a major issue.  Perhaps I should have labelled the code "beta" as there is still a lot of development to do.  With Nicolas' and cfta's permission, I would like to incorporate their money management code.  The post was "Grid orders with one combined stop loss and limit, can it be done?".

The other work needed is to reduce the number of false trades by having the entries based on a divergence between the Coppock and price.

Elsborgtrading
10 years ago
#

Hi Mike and thanks for sharing. It looks very promising -on the back test. I took a quick test on DAX mini £1 and I gained around 2000% from aug2012 until now. The problem is that it looks like a martingale code(?) I'm no expert but lets say that jan 2015 to apr 2015 it keeps selling on a rising trend- it of cause gets "rescued" in the end and only looses 46000 euro - however if this was on a live trade with IG and you put 92 contracts up with a P/L around -100000 euro and 50000 left in your account you will almost get a margin call. Same with all the other cycles of adding contracts- it's balancing on a margin call from time to time(without having tested it in depth). Rule of thumb at least what I've heard, you should always manage your money and only trade for 1-2% of what you can afford to loose. this means that max2% with a P/L on -46000 euro you should have 2.3 mill euro on the account. One day in the future we might not be that lucky and getting stopped out by a margin call. However IG will only close some of the position until you have the required margin again so it will properly never loose the entire amount in the account- only prolonging the emotional pain. Think about if you sat and watched you equity fall from 156000 to 50000 euro live you would not be able to sleep, eat or think about anything else for 4 month, you would be max stressed out not knowing where this would end. Just saying :-)

MikeGC
10 years ago
#

Hi CKW, 

The SuperTrend is the stop loss and exit.  That is why it is important to optimise the variables for the ST for the instrument you are trading.  For instance, I have the ST set at 4,42 for the DAX.  I set it up to auto trade on Monday at the open and it is currently showing a profit of some EUR 11,000 using an account of EUR 10,000 to start, with a spread of 2 points and no fees.

I agree with you that the drawdowns during testing have been high, but it is a trade-off.  The higher the drawdown risk, the more room the system has to "breathe".  However, I will be looking at ways to introduce money management rules to limit the drawdown.  Any ideas?

Cheers,

Mike

CKW
CKW
10 years ago
#

 Hi  MikeGC,

Thanks for your sharing. I tried it on DAX

Overall the probability winning trades seems good but it can be risky without SL. Have you try to putting SL to avoid large drawdown? I tried but result is not good

Br

CKW

Lepori Joël
10 years ago
#

Hello Mike and  larouedegann,

Thank you so much for your help and fast answer.

I wish you a good start to week

jo

ProRealCode ProRealCode
Loading...