Long only strategy for the BUND (1 eur per contract) on a 4 hours timeframe. Backtest with 2 points spread from mid-2010 to now.
Signals are taken from a super smoothed filter (indicator “PRICE ACTION BUND”). Profit are trailed with a soft coded trailing stop in the strategy.
//--------------------------------------------------------------------------------
// STRATEGY BYE BYE BYE BUND
// IG MARKET - FGBL BUND 1 EUR - 4 H - SPREAD 2
DEFPARAM CumulateOrders = false
PositionSize = 1
indicator1, ignored = CALL "PRICE ACTION BUND"
c1 = (indicator1 >= 1)
indicator1, ignored = CALL "PRICE ACTION BUND"
c2 = (indicator1 <=- 1)
indicator1, ignored = CALL "PRICE ACTION BUND"
c3 = (indicator1 crosses over 0)
IF c1 or c2 or c3 AND CurrentDayOfWeek <> 1 THEN
BUY POSITIONSIZE CONTRACT AT MARKET
ENDIF
// TRAILING STOP LOGIK BY KENNETH KVISTAD MODIFIED FOR LONG AND SHORT POSITION
TGL =66
if not onmarket then
MAXPRICE = 0
EXITPRICE = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
EXITPRICE = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if onmarket and EXITPRICE>0 then
SELL AT EXITPRICE STOP
ENDIF
SET STOP PLOSS 350
SET TARGET PPROFIT 500
Indicator needed to run the strategy (“PRICE ACTION BUND”)
// UNIVERSAL CODE POSTED BY NICOLAS
// INDICATOR PRICE ACTION BUND
bandedge=50
whitenoise= (Close - Close[50])
if barindex>bandedge then
// super smoother filter
a1= Exp(-1.414 * 3.14159 / bandedge)
b1= 2*a1 * Cos(1.414*180 /bandedge)
c2= b1
c3= -a1 * a1
c1= 1 - c2 - c3
filt= c1 * (whitenoise + whitenoise[1])/2+ c2*filt[1] + c3*filt[1]
filt1 = filt
if ABS(filt1)>pk[1] then
pk = ABS(filt1)
else
pk = 0.99* pk[1]
endif
if pk=0 then
denom = -1
else
denom = pk
endif
if denom = -1 then
result = result[1]
else
result = filt1/pk
endif
endif
RETURN result COLOURED(66,66,205) as "PRICE ACTION", 0 as "0"