Internal Bar Strength Gold XAUUSD 2 hours TIMEFRAME

Category: Strategies By: victormork Created: November 14, 2017, 9:48 AM
November 14, 2017, 9:48 AM
Strategies
8 Comments

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!

//////////////////////////////////////////////////////////////////
//// 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

Download
Filename: Internal-Bar-Strength.itf
Downloads: 509
victormork Veteran
Currently debugging life, so my bio is on hold. Check back after the next commit for an update.
Author’s Profile

Comments

Logo Logo
Loading...