juanj

Ichimoku DM strategy SAF40 - 1 hour

Category: Strategies By: juanj Created: June 9, 2017, 1:04 PM
June 9, 2017, 1:04 PM
Strategies
14 Comments
Ichimoku DM strategy SAF40 - 1 hour

I wrote this strategy today after studying some Ichimoku Trading Stategies.

It is mainly based around Ichimoku breakout strategy but also includes checks for Directional Movement and Divergence.

I wrote it for my local market (South Africa 40 Cash) on the 1Hr Timeframe on which it performs okay, which is no mean feat.

But to be completely honest i am disappointed with Ichimoku as an automated strategy in general.

But enough mumbling. Here is the code, maybe someone will find it useful.

Time schedule are adapted to intraday spread (8 points).

//Stategy: IchimokuDM
//Market: South Africa 40 Cash (ZAR2 Micro)
//Timeframe: 1Hr
//Spread: 15
//Timezone: UTC +2

Defparam Cumulateorders = False
Defparam Flatbefore = 073000
Defparam Flatafter = 163000

If hour < 9 or hour > 17 then //Works in conjunction with Flat Before/After time
possize = 0
If longonmarket then
SELL AT MARKET
ElsIf shortonmarket then
EXITSHORT AT MARKET
EndIf
Else
possize = 2 //Minimum position size
EndIf

P = 11 //Standard Period
R = P*2 //Standard Period x 2
I = P*3 //Standard Period x 3
TS = (highest[P](high)+lowest[P](low))/2 //Tenkan-Sen
KS = (highest[I](high)+lowest[I](low))/2 //Kijun-Sen
CS = close[I] //Chikou-Span
SA = (TS+KS)/2 //Senkou-Span A
SB = (highest[I](high)+lowest[I](low))/2 //Senkou-Span B
DP = DIplus[R](close) //DI+
DN = DIminus[R](close) //DI-
AX = ADX[R] //ADX
ATR = AverageTrueRange[P](close)

If RSI[R](close) > RSI[R](close[I]) Then
 If close < CS Then
  BDIV = 1 //Buy Divergence Present
  SDIV = 0
 EndIf
EndIf

If RSI[R](close) < RSI[R](close[I]) Then
 If close > CS Then
  BDIV = 0 //Sell Divergence Present
  SDIV = 1
 EndIf
EndIf


If countofposition = 0 and BDIV = 1 and AX > 17 and DP > 20 and DP > DN and close > SA and close > SB and TS > KS and close > CS and Close > SA[I] and Close > SB[I] Then
 Buy possize*3 contracts at close + ATR stop
EndIf

If countofposition = 0 and SDIV = 1 and AX > 17 and DN > 20 and DP < DN and close < SA and close < SB and TS < KS and close < CS and Close < SA[I] and Close < SB[I] Then
 Sellshort possize*3 contracts at close - ATR stop
EndIf

If Longonmarket then
 If close < TS Then //If close below Tenkan-Sen Line
  If close < close[1] Then
   Sell at Market //Close position at next lower close
  EndIf
 EndIf
ElsIf Shortonmarket then
 If close > TS Then //If close below Tenkan-Sen Line
  If close > close[1] Then
   Exitshort at Market //Close position at next higher close
  EndIf
 EndIf
EndIf

Set Stop pLOSS ATR*4
Set Target pPROFIT ATR*5

 

Download
Filename: IchimokuDM-Strategy.itf
Downloads: 369
juanj
juanj Master
My name is Juan Jacobs and I am an algorithmic trader and trading coach. After 7 years of corporate work as a Systems Analyst, I have decided to pursue my passion of trading on a full-time basis. My current focus area is that of 'smart' strategies based on 'Machine Learning'. You can find me at www.FXautomate.com or visit my PRC Marketplace Store here: https://market.prorealcode.com/store/fxautomate/
Author’s Profile

Comments

Louwrens
9 years ago
#

Hi Juanj. Thanks for this. I am tying it as we speak. It does not trade that often, which is fine.But I am trying to develop a short term strategy for the SA40 on the 3,5 or 10min timeframe, that trades a few time a day with small gains, that could add up to larger ones. Could you suggest some indicators to use to achieve this? I have played around with the most common ones without success. Stochastic,RSI,MADC etc.

juanj
9 years ago
#

For the latest version and discussions see the Ichimoku thread here: https://www.prorealcode.com/topic/ichimoku-strategies-general-discussion/#post-46741

juanj
9 years ago
#

No, this is still the original version. I will post the new version in the forum sometime today and share the link.

nwesterhuijs
9 years ago
#

Thanks, only saw it just now.

#

*Bump* Have the code been swapped to the new one?

corne
9 years ago
#

Hi there - is there maybe somewhere a new version available to look at?

Magnus Park
9 years ago
#

Hi! Thanks for sharing! Have the code been swapped to the new one? or is it the first one still in the link?

juanj
9 years ago
#

I actually completely re-wrote this strategy as I found I actually coded it VERY wrong. My new version is in my opinion probably one of the best Ichimoku strategies out there. @Nicholas are there any way I can replace this version?

 

nwesterhuijs
9 years ago
#

Did you change the Kijun-Sen to the "Standard Period x 2" and corrected the Senkou-Span B so it is not the same as the Kijun-Sen calculation, but continued the use of the "Standard Period x 3" for the SPAN-B?

nwesterhuijs
9 years ago
#

Juanj, is it possible to just paste the new code in this comment section as some people do, given that it is uncertain at the moment whether or not the code above has been updated? Tnx, Norbert

Nicolas
9 years ago
#

Please send it to me with the contact form, thanks.

juanj
9 years ago
#

@CKW I cannot remember but it is easy to optimize for different time-zones just comment out the Flatbefore and Flatafter times and use variables to search for the best time period. I sometimes just optimize variable x and use 8 for variable y:

If hour < x or hour > x+y

CKW
CKW
9 years ago
#

Thanks Juanj for sharing this.

May I know what time frame you have changed for DAX?

juanj
9 years ago
#

Seems to work well on the DAX as well. Just change the timeframe and Stop pLOSS to ATR*3

ProRealCode ProRealCode
Loading...