This strategy works on several markets but in this example I focused on gold.
The strategy is based on the Internal Bar Strength Indicator (IBS=(Close – Low) / (High – Low) * 100), and by using this indicator I’ve made a mean reversion strategy which basically gives you a high win rate thanks to a large stop loss distance. To find out if this is good or bad you need to do some further testing.
Anyhow, the main rule is as follow:
- Buy when the IBS closes below a certain value and exit when the price closes above yesterday’s high.
- Sell when the IBS closes above a certain value and exit when the price closes below yesterday’s low.
Apart from the main rule, I have also added some extra stuff to boost the performance of this backtest. You can optimise all of this in the top section.
Enjoy!
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 |
////////////////////////////////////////////////////////////////// //// Sport Gold (E1 Contract) Spread 0.5 ////////////////////////////////////////////////////////////////// DEFPARAM CumulateOrders = False DEFPARAM PreloadBars = 200 ////////////////////////////////////////////////////////////////// //// Opti ////////////////////////////////////////////////////////////////// longtrigger = 9 shorttrigger = 91 maperiod = 100 maPeriod1 = 20 // Moving Average Period 100 maType1 = 2 // Moving Average function stoplossmulti = 8 possize = 10 ////////////////////////////////////////////////////////////////// //// Indicators ////////////////////////////////////////////////////////////////// IBS = (Close - Low) / (High - Low) * 100 ma = average[maperiod](close) ma1 = average[maPeriod1, maType1](customClose) slope1 = ma1 - ma1[1] ////////////////////////////////////////////////////////////////// //// Entry conditions ////////////////////////////////////////////////////////////////// b1 = not longonmarket // only open 1 position b1 = b1 and close < Dhigh(1) // close below yesterday's high b1 = b1 and IBS < longtrigger // Internal bar strength below trigger value b1 = b1 and close > ma // close over moving average b1 = b1 and slope1 > 0 // ma slope is positive s1 = not shortonmarket // only open 1 position s1 = s1 and close > Dlow(1) // close above yesterday's low s1 = s1 and IBS > shorttrigger // Internal bar strength below trigger value s1 = s1 and close < ma // close over moving average s1 = s1 and slope1 < 0 // ma slope is negative ////////////////////////////////////////////////////////////////// //// Exit conditions Short ////////////////////////////////////////////////////////////////// el1 = close > Dhigh(1) // close above yesterday's high es1 = close < Dlow(1) // close below yesterday's low ////////////////////////////////////////////////////////////////// //// Execution ////////////////////////////////////////////////////////////////// if b1 then buy possize contract at market endif if s1 then sellshort possize contract at market endif if el1 then sell at market endif if es1 then exitshort at market endif ////////////////////////////////////////////////////////////////// //// Stop loss ////////////////////////////////////////////////////////////////// set stop ploss (averagetruerange[14] * stoplossmulti)*pointsize |
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
Thanks for sharing, did you tested it on 200 000 bars
Hi! No I don’t have 200k history.
There is a huge drawdown from 2012 to 2013 after it keeps rising
https://ti.md.it-finance.com/ProRealTime_V10_3/display_chartimage.phtml?name=7ocfhe7dftht26ygzmeyfal5q&type=png&purpose=share_twitter
Thanks for sharing the 200k test!
La fonction stoplossmulti ne change rien cela doit provenir de l’averagetruerange existe t il plusieurs versions de averagetruerange ???
Bonjour Nicolas la formule du stop loss est elle vraiment valable ?? il n’y a pas au depart de calcul de différence entre tradeprice et atr??
Il y a peut-être un erreur en effet, essayer avec:
set stop ploss (averagetruerange[14] * stoplossmulti)/pointsize
ou mieux
set stop loss (averagetruerange[14] * stoplossmulti)
ok merci Nicolas c’est avec /pipsize que ça fonctionne