Hi, I want to share my first simple EUR/USD (mini) 5 min Strategy, based on the ATR and two Moving Averages. As you can see it reacts to the recurring ATR pattern, when the EU Session starts, some Volume and Volatility came into the Market. It Trades Long, when the ATR Crosses above 0,0003 and the moving averages are positiv. It Trades Short, when the ATR Crosses above 0,0003 and the moving averages are negativ. I test it with a 1,5 Spread.
I also test the Strategie with the following parameters:
ATR (14)
Stop 40
Profit 40
It is slightly worse than the current parameters, but it has not such a Drawdown at the end. Unfortunately I can not make a longer backtest. If someone has the possibility, I would be very happy, also if someone had good ideas to optimize it. 🙂
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
// Das Handelssystem wird um 0:00 Uhr alle pending Orders stornieren und alle Positionen schließen. Es werden vor der "FLATBEFORE"-Zeit keine neuen Orderaufträge zugelassen.
DEFPARAM FLATBEFORE = 080000
// Stornieren aller pending Orders und Schließen aller Positionen zur "FLATAFTER"-Zeit
DEFPARAM FLATAFTER = 210000
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen vor einer bestimmten Uhrzeit
noEntryBeforeTime = 080000
timeEnterBefore = time >= noEntryBeforeTime
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen nach einer bestimmten Uhrzeit
noEntryAfterTime = 153000
timeEnterAfter = time < noEntryAfterTime
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = AverageTrueRange[5](close)
c1 = (indicator1 CROSSES OVER 0.0003)
indicator2 = Average[10](close)
indicator3 = Average[20](close)
c2 = (indicator2 > indicator3)
IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Bedingungen zum Einstieg in Short-Positionen
indicator4 = AverageTrueRange[5](close)
c3 = (indicator4 CROSSES OVER 0.0003)
indicator5 = Average[10](close)
indicator6 = Average[20](close)
c4 = (indicator5 < indicator6)
IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Stops und Targets
SET STOP pLOSS 36
SET TARGET pPROFIT 54
Hi @imokdesign, great idea and nice post. I moved your strategy to the forum instead, to discuss about it. I made longer backtest and even if the result is not so bad, I should it should desserve a deeper analysis to make it even better! 🙂
Did you try to make dynamic stoploss and takeprofit instead of fixed ones in points?
Thanks for the qick reply. Yes, it would be nice if it will be discussed. 🙂 During the construction, I also tried just a ptrailingstop. But it didn’t work well. What do you mean exactly with “dynamic” Stop or Profit? Stop by an other indikator, ATR, or Trendstop at point3, etc. ? … or more then one Profittarget? Maybe I have to look at it a little bit closer again, it looks that it close its actual position when the next signal comes (screenshot). Maby I could change something at this point, or maby it needs a just a simple 200 sma.
… oh I am sorry: that was the wrong screenshot here is the correct one:
Stop by an other indikator, ATR, or Trendstop at point3, etc. ?
Exactly, a 54 points profit target doesn’t mean the same thing in a quiet market than in a strong directional one. By increasing the target/profit, you could also increase the risk reward ratio and afford to reduce the win/loss one.
I think my knowledge for an coding an ATR Stop is not enough at the moment. I looked at some Threads, and find some snippets from this post.
Open Range Breakout ATR(14)
But i dont know it is the right way, maby i need some help, or just a small note.
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
// Das Handelssystem wird um 0:00 Uhr alle pending Orders stornieren und alle Positionen schließen. Es werden vor der "FLATBEFORE"-Zeit keine neuen Orderaufträge zugelassen.
DEFPARAM FLATBEFORE = 080000
// Stornieren aller pending Orders und Schließen aller Positionen zur "FLATAFTER"-Zeit
DEFPARAM FLATAFTER = 210000
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen vor einer bestimmten Uhrzeit
noEntryBeforeTime = 080000
timeEnterBefore = time >= noEntryBeforeTime
// Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen nach einer bestimmten Uhrzeit
noEntryAfterTime = 153000
timeEnterAfter = time < noEntryAfterTime
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
price = close
atr = averagetruerange[5]*2
triggerB = price+atr
triggerS = price-atr
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = AverageTrueRange[5](close)
c1 = (indicator1 CROSSES OVER 0.0003)
indicator2 = Average[10](close)
indicator3 = Average[20](close)
c2 = (indicator2 > indicator3)
IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 1 share at triggerB stop
ENDIF
// Bedingungen zum Einstieg in Short-Positionen
indicator4 = AverageTrueRange[14](close)
c3 = (indicator4 CROSSES OVER 0.0003)
indicator5 = Average[10](close)
indicator6 = Average[20](close)
c4 = (indicator5 < indicator6)
IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
SELLSHORT 1 share at triggerS stop
ENDIF
// Stops und Targets
SET STOP pLOSS atr
SET TARGET pPROFIT 15
You should replace your stoploss keyword:
SET STOP LOSS atr
pLOSS is for points (15 pips), while LOSS is for real price value (0.0015 pips for EURUSD) and this is the case of your “atr” variable.
Thanks for the note, I had it totally overlooked. Last Weeks, I have now tried to improve the Strategy and stoptechniques, but In no attempt I have come to a better result. There is a thing, I do not quite understand yet. If I make certain stop atr settings, it looks as if it is Trade less. Why that? The strategy is the same, i just change the stop loss?
I have been watching this strategy for several Weeks. Sometimes (Rare) it happens that the strategy turns itself off, without the regularly Date update has expired. Does anyone know why that is, or is it due to the new LRAccount and Proorder requirements? I can not find a Codeline that speaks for it.
Would it be possible to program an email message when this case arrives?