Heiken Ashi TMS/TDI strategy

Category: Strategies By: Elsborgtrading Created: August 6, 2016, 7:13 PM
August 6, 2016, 7:13 PM
Strategies
16 Comments

Hi guys.

My first contribution to the strategy site. It’s based on several codes from the site, but mainly the TDI and TMS from both Nicolas and Reiner. I changed the strategy a bit so it fits the Oil- Brent Crude. It seems like that every strategy that I test need to be “adjusted” to the particular instrument. Does anyone do the same, or do you strictly keep the rule? Anyway the code has no zero bar profit nor does it have SL or TP coded, in fact it has only 15 trades over 3 month. It sure could be more “perfect” as there are some entries that could be more profitable. Unfortunately I can only backtest it 3 month. Apparently IG only hold 3 month of data for Crude Oil. It’s tested with a 3 point spread. Anyway here it is, please comment 🙂

Cheers

Kasper

//TDI OIL 2H elsborgtrading
// based on Trend Surfer DAX-Reiner/Nicolas-TMS
//http://www.prorealcode.com/prorealtime-trading-strategies/trend-surfer-dax/
//http://www.prorealcode.com/topic/trading-made-simple-tms-system/
//http://www.forexmt4.com/_MT4_Systems/Traders%20Dynamics/TDI_1.pdf

// code-Parameter
DEFPARAM CumulateOrders = true

//DEFPARAM FlatAfter = 230000
//DEFPARAM Flatbefore = 030000

//MONEY MGT//

Equity = (Strategyprofit+20000)
Risk = round(Equity/100000)
Losses = positionperf(1)<0 and positionperf(2)<0 and positionperf(3)<0
streak = positionperf(1)>0 and positionperf(2)>0 and positionperf(3)>0
if losses then
 PositionSize  = max(abs(round(max(3+risk-2,risk-2))),2)
elsif not losses then
 PositionSize  = max(abs(round(max(3+risk,risk))),2)
endif
if streak then
 PositionSize  = max(abs(round(max(5+risk,risk))),2)
endif

//TDI indicator
//parameters :
lengthrsi=13
lengthrsipl=2
lengthtradesl=7

//overbought and oversold values of the TDI indicator
upperzone = 68
lowerzone = 32

//heiken ashi
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
 xOpen = (xOpen[1] + xClose[1])/2
 xHigh = Max(xOpen, xClose)
 xLow = Min(xOpen, xClose)
endif

//indicators
r = rsi[lengthrsi](close)
mab = average[lengthrsipl](r)
mbb = average[lengthtradesl](r)
yellowMA = average[5](TypicalPrice)
yellowMAshifted = yellowMA[2]

//trade conditions
longCondition = mab crosses over mbb AND mab<50 AND xHigh>yellowMAshifted
shortCondition = mab crosses under  mbb AND mab>50 AND xLow<yellowMAshifted
Longsell=mab crosses under mbb AND mab<upperzone and mab>50 AND xlow>yellowMAshifted
Shortexit= mab crosses over mbb AND mab>lowerzone and mab<50 AND xhigh>yellowMAshifted

//***************************

// open position
// long
IF Not LONGONMARKET AND longcondition THEN
 BUY PositionSize CONTRACT AT MARKET
ENDIF

// short
IF Not SHORTONMARKET AND shortCondition THEN
 SELLSHORT PositionSize CONTRACT AT MARKET
ENDIF

// close position
//Longsell
IF LONGONMARKET and Longsell  THEN
 SELL AT MARKET
ENDIF

//Shortexit
IF SHORTONMARKET and Shortexit THEN
 EXITSHORT  AT MARKET
ENDIF

 

Download
Filename: TDI-OIL-2H-ElsborgTradingV3.itf
Downloads: 299
Download
Filename: Screenshot_202.png
Downloads: 89
Download
Filename: Screenshot_203.png
Downloads: 247
Download
Filename: Screenshot_200.png
Downloads: 90
Download
Filename: Screenshot_201.png
Downloads: 76
Download
Filename: Heiken-Ashi-TMS-TDI-strategy.itf
Downloads: 614
Download
Filename: Screenshot_148.png
Downloads: 146
Download
Filename: Screenshot_147.png
Downloads: 368
Download
Filename: Screenshot_149.png
Downloads: 109
Elsborgtrading 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...