Hi all !
Here is a very simple code, but very effective, in order to trade the DAX.
It’s a Day trading strategy, but it is designed for H4 timeframe.
It concerns the 3 candles : from 9AM to 21PM.
We go long at 09AM if :
close > 200 moving average
MACD > 0
We close positions at 21PM.
Stop loss and take profit : 1% and 3%
That’s all !
As you see, this very simple trend following strategy is positive (with spread : 1 point), on the last 10 years.
It is’nt before, but I think the DAX CFD trading hours were different.
It should be easy to improve this code, I’ve already made some improvements.
But I prefer giving you the basic and simple (but effective !) code.
DEFPARAM CumulateOrders = False
DEFPARAM flatafter = 210000
// TAILLE DES POSITIONS
MM = Average(close)
iMACD = MACD[12,26,9](close)
ca1 = close > MM
ca2 = iMACD > 0
IF ca1 AND ca2 AND time >= 090000 THEN
BUY AT MARKET
cv1 = close < MM
cv2 = iMACD < 0
IF cv1 AND cv2 AND time >= 090000 THEN
SELLSHORT AT MARKET
// Stop et objectifs
SET STOP %LOSS 1
SET TARGET %PROFIT 3
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.ProRealTime ITF files and other attachments :
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
TP at 3%, isn’t it a bit too much ? Someone knows how many trading days saw the DAX moving than more than 3 % ?
You reach TP very very few times.
Buy it happens on some days.
Most of the time, you close at evening, that’s all.Without TP ans SL, the strategy is still profitable.
so you count more on the “flatafter” than on tp ?
Yes, that’s the way.
Hi, i’m from Perú
The time is 09:00 to 21:00 GMT?
It’s 9:00 on my broker (ProRealTime CFD), so I think it is GMT+1.
Would you trade using this strategy, as it is really profitable since 2014 ?Thanks.
So between 2009 and 2012 you take no profit, thats a long time to sit around and see it do nothing.
Yes and that’s why a lot of strategies are never published, because people are impatient… This strategy are proof that automated trading work, so just sit and relax, and make profit while doing nothing. 😉
Hi, I am not sure if this is the right way to do this but I see here many professionals that maybe can help here to figure this up…
I wrote a simple, similar code and its opposite one, i.e., entering in the counter position when exact the same condition occurs, TP3% and SL1%.
To my overwhelming, when activating the both on the same time frame (Daily) at the same period (last month) I saw days where both came profit.
Can you explain? Attached is added
// Conditions First code// Condition to enter long
c3L = MACD[12,26,9](close)<0//close < open
IF c3L and NOT ONMARKET and currenttime > 100000 THEN
Buy 1000 Cash ROUNDEDDOWN AT MARKET
// Conditions to enter short
c3S = MACD[12,26,9](close)>0//close > open
IF c3S and NOT ONMARKET and currenttime > 100000 THEN
SELLSHORT 1000 Cash ROUNDEDDOWN AT MARKET
SET TARGET %PROFIT 3
SET STOP %LOSS 1
//--- Conditions Second code----
// Conditions to enter longc3L = MACD[12,26,9](close)>0//close > openIF c3L and NOT ONMARKET and currenttime > 100000 THENBuy 1000 Cash ROUNDEDDOWN AT MARKETENDIF// Conditions to enter shortc3S = MACD[12,26,9](close)<0//close < openIF c3S and NOT ONMARKET and currenttime > 100000 THENSELLSHORT 1000 Cash ROUNDEDDOWN AT MARKETENDIFSET TARGET %PROFIT 3SET STOP %LOSS 1
We’re talking about trading, on derivatives, when you could potentially lose a lot. You shouldn’t be talking about “making profit while doing nothing” Nicolas, that sounds so awkward and untrue. I’m testing this strategy and i just had a drawdown of 8 losses, losing 2000 € (in test hopefully).
8 losses in a row sounds possible in trading. Strategies in library are there because people were kind enough to share what they discovered while coding. FYI, there are a lot of codes that I don’t approve to be featured in. My answer to Yngve may be sound sarcastic, but that’s the way how I talk sorry for that, did I mention I put a smiley? Anyway, 2k€ is how much percent of your demo account?
The backtest shows a maximum loosing streak of 8 consecutive trades. So it is possible.
That’s trading, you could also have 8 winning trades.
That’s also why I don’t like martingale.
hopefully – thankfully
then i’ll have a smiley too
and thanks for all the advice
what i wanted to say, is that if you enter now into this pattern of auto trading, you would have a drawdown of 9 consecutive losses, wich could kill your account, so even with a smiley, please do consider that people that would read you would take what you say very seriously (either clients, or regulators). Some are really seeking for a way to earn money doing nothing in a secure way, we have to be very careful in what we say and the way we say.
Yes you are right, maybe I need to add more disclaimer? I’m actually trading some automated system that can kill my account and I assume myself the responsibility of my own trading decision. There are no “blackbox” system here, all codes are readable by everyone, they are free and no one are earning money by putting them on this website. I’m not selling ebook or magical potion to make everyone a millionaire, there are also no publicity on the site.
My attention for the answer I made were to say that criticism is easy when you just click and download. Trading systems that do not make profit even in 2 consecutive years do not invalidate a strategy that work well over a decade. We could have this discussion in every code shared here, sometimes things go bad, sometimes trades go well.. that’s how it goes and no one can change this..
I hope you are well. As you can see, some of us post various strategies. But you must understand that :
these are not definitive and commercial strategies. These a good strategies that we publish for free, as “open codes”. So everyone can use and improve those strategies (the goal is to improve them), but it doesn’t mean that these strategies are always used by ourselves.
myself, I don’t use all the strategies that I did post, of course ! I use only 3 strategies of my own. And it is less than 10% of my capital. The > 90% of my capital is secured investment.
Even the better traders who get 100% annual return in trading tournaments have drawdowns… usually 50% drawdown.
9 consecutive losses doesn’t have to make afraid, depending of the strategy. The rule n°1 of trading is : PROTECT your capital ! So I don’t bet more than 1% risk per trade (when I was a beginner, I did bet 5 to 10% sometimes… it did annihilate my account twice, and nearly a third time). 9 consecutive losses would be 9%. But if the reward ratio is 3:1, only 5 wins would make +15%. See for example the “Breakout ProOrder CAC40” : the winning ratio is low, but the strategy wins on the long term, because average wins are greater than average losses.
This is what Nicolas wisely said : some losses do not invalidate a good strategy. Maybe we will have soon a “disclaimer” word.
I hope this helps, and I wish you good trades. You can ask for help whenever.Best regards,
Thanks for posting this! It is always interesting to see what people have found to work. One question: In the picture for the article, the results page shows both long and short positions, while the code is strictly long-only. Is the picture relevant for this code?
Please accept my apologies, I believe I should go to bed instead of posting irrelevant questions. Anyway, thanks again for this post!
Ahah, I’m not the author of this one 🙂
I know you are a great coder Wilko, why don’t you post one or two of your findings? Hope to see content from you very soon 🙂
Thanks for the flattery! I will, I promise.
Still don’t have seen anything from your own 🙂 You promised me! Ahaha