Hello, I want to introduce you to one of my works. I hope for numerous comments and for one or the other idea whether there is still room for improvement.
The system traditionally acts as a setback in the upward trend. Doubled over a grid with greater loss, but is capped at a maximum of 3 positions. So quite risk-free.
I also added a multi-timeframe, but only to get even better results with the trailing stop.
I have been trading a similar system in the H1 for a long time, with great results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
// Festlegen der Code-Parameter DEFPARAM CumulateOrders = true // Kumulieren von Positionen deaktiviert DEFPARAM Preloadbars = 300 //timeframe(15 minute, updateonclose) gridStep = 20 //20 MAXSHARES = abs(COUNTOFPOSITION) <= 1 //1 // Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen vor einer bestimmten Uhrzeit noEntryBeforeTime = 010000 timeEnterBefore = time >= noEntryBeforeTime // Verhindert das Platzieren von neuen Ordern zum Markteintritt oder Vergrößern von Positionen nach einer bestimmten Uhrzeit noEntryAfterTime = 233000 timeEnterAfter = time < noEntryAfterTime // Verhindert das Trading an bestimmten Wochentagen daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 // Long indicator1 = Average[25](close)//25 indicator2 = Average[180](close)//180 c1 = (indicator1 CROSSES UNDER indicator2) indicator3 = ADX[14] c2 = (indicator3 > 10) indicator4 = ADX[14] c3 = (indicator4 < 30) //30 IF not longonmarket and (c1 AND c2 AND c3) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN BUY 1 CONTRACT AT MARKET ENDIF //grid if longonmarket and tradeprice-close>=gridStep*pointsize and maxshares then buy 2 contract at market endif // Longexit indicator5 = Average[25](close)//25 indicator6 = Average[180](close)//180 c4 = (indicator5 CROSSES OVER indicator6) IF c4 THEN SELL AT MARKET ENDIF // Stops und Targets SET STOP pLOSS 75 //75 //timeframe(default) //5 minute //************************************************************************ //trailing stop function trailingstart = 8 //8 trailing will start @trailinstart points profit trailingstep = 1 //1 trailing step to move the "stoploss" //reset the stoploss value IF NOT ONMARKET THEN newSL=0 ENDIF //manage long positions IF LONGONMARKET THEN //first move (breakeven) IF newSL=0 AND close-positionprice>=trailingstart*pipsize THEN newSL = positionprice+trailingstep*pipsize ENDIF //next moves IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN newSL = newSL+trailingstep*pipsize ENDIF ENDIF //manage short positions IF SHORTONMARKET THEN //first move (breakeven) IF newSL=0 AND positionprice-close>=trailingstart*pipsize THEN newSL = positionprice-trailingstep*pipsize ENDIF //next moves IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN newSL = newSL-trailingstep*pipsize ENDIF ENDIF //stop order to exit the positions IF newSL>0 THEN SELL AT newSL STOP EXITSHORT AT newSL STOP ENDIF |
Share this
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
You got some potential here. A couple of things I think about:
1, The opening hours in this script (01.00 – 23.30) is very generous and the spread in reality is very high (5 points) between 22.00 and 08.00. That should be considered.
2, Does the grid work? I get no effect when changing it.
Hab festgestellt, das US500 fast noch besser funktioniert als der Dax. Was aber auch daran liegt, das US500 kaum Bärische Zonen aufweist.
Ich habe hier mit Spread 2 gerechnet, also etwa dem Mittelwert zwischen Tag und Nacht. Das Grid funktioniert. Man kauft nach wenn die Position zum Kerzen close 20 Punkte im Minus liegt. Aber nur einmal, zur Risikobegrenzung.
Im H1 mit veränderten Werten sieht man, das das System auch in Bärischen Phasen funktioniert. Ich habe auch noch eine Version im M1, die funktioniert super. Sollte man aber mit Bedacht einsetzen.
hey my friends, thank you for this great code. my problem is he make no trade open. backtest is in 20.000 witj 5min very perfekt. i have chance from 15 to 5min but not open. my next ask : what is postion 8 ? when put to 0.5 he make only 1 contarkt at back test, this for me perfekt. money is 900 in test account. can you help me please ? thank alot
Can i put a Action that my start contract is smaller than 1 ?
0.3 or 0.5 ? In wich Position?
Thank you
I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far. Note the opening times 01:00 – 23:30. Position 8 is the maximum buy / sell order. You can also try without the martingale. Works in the long term as well. Maybe adjust SL.