Doctrading

Ichimoku Tenkan-Kijun Cross

Category: Indicators By: Doctrading Created: March 25, 2016, 10:05 AM
March 25, 2016, 10:05 AM
Indicators
18 Comments
Ichimoku Tenkan-Kijun Cross

This code shows an Ichimoku indicator, for Tenkan-Kijun cross.
+1 for buy conditions
-1 for sell conditions

Buy conditions :

Tenkan crosses over Kijun

Tenkan & Kijun > Kumo

Close > Kumo

Chikou > Kumo

Sell conditions : the opposite

INDICATEUR = 0

Tenkansen = (highest[9](close)+lowest[9](close))/2
Kijunsen = (highest[26](close)+lowest[26](close))/2

SSpanA = (tenkansen[26]+kijunsen[26])/2
SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2

Chikou = close[26]


// ACHAT
C1 = close > SSpanA and close > SSpanB
C2 = Tenkansen crosses over Kijunsen
C3 = Tenkansen > SSpanA and Tenkansen > SSpanB
C4 = Kijunsen > SSpanA and Kijunsen > SSpanB
C5 = Chikou > SSpanA[26] and Chikou > SSpanB[26]

IF C1 and C2 and C3 and C4 and C5 THEN
 INDICATEUR = 1
ENDIF

// VENTE
C1v = close < SSpanA and close < SSpanB
C2v = Tenkansen crosses under Kijunsen
C3v = Tenkansen < SSpanA and Tenkansen < SSpanB
C4v = Kijunsen < SSpanA and Kijunsen < SSpanB
C5v = Chikou < SSpanA[26] and Chikou < SSpanB[26]

IF C1v and C2v and C3v and C4v and C5v THEN
 INDICATEUR = -1
ENDIF


return INDICATEUR as "ICHIMOKU TKC"

Happy Trading !

Download
Filename: Ichimoku-Tenkan-Kijun-Cross.itf
Downloads: 607
Doctrading
Doctrading Master
Hello, I'm Marc. Nice to meet you.
Author’s Profile

Comments

Emperor.it
6 years ago
#

Chikou = close[26] it's a mistake. Chikou Span is today's closing moved back 26 periods. It is not the close of 26 periods ago.

Nicolas
6 years ago
#

Indeed, there is a mistake in that code. It is often the case when using Ichimoku and its translated lines backward or forward

Ronny
7 years ago
#

Should C5 = Chikou > SSpanA[26] and Chikou > SSpanB[26] be C5 = Chikou > SSpanA and Chikou > SSpanB? Shouldn't we check if Chikou is above the CURRENT cloud? Or am I missing something?

Domingos Amoedo
8 years ago
#

Hello, thanks for this code. I need to change the c5 and c5v conditions for this ones: C5 (for long positions): the Chikou Span is above the price curve. C5V (for short positions): the Chikou Span is below the price curve. These two conditions add greater strength to buy/sell signals. Thanks in advance.

Sebausse
8 years ago
#

I have corrected the code which was only returning "buy" condition: Tenkansen = (highest[9]+lowest[9])/2 Kijunsen = (highest[26]+lowest[26])/2 SSpanA = (tenkansen[26]+kijunsen[26])/2 SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2 Chikou = close[26] // ACHAT C1 = close > SSpanA and close > SSpanB C2 = Tenkansen crosses over Kijunsen C3 = Tenkansen > SSpanA and Tenkansen > SSpanB C4 = Kijunsen > SSpanA and Kijunsen > SSpanB C5 = Chikou > SSpanA[26] and Chikou > SSpanB[26] LongCondition = C1 and C2 and C3 and C4 and C5 // VENTE C1v = close < SSpanA and close < SSpanB C2v = Tenkansen crosses under Kijunsen C3v = Tenkansen < SSpanA and Tenkansen < SSpanB C4v = Kijunsen < SSpanA and Kijunsen < SSpanB C5v = Chikou < SSpanA[26] and Chikou < SSpanB[26] ShortCondition = C1v and C2v and C3v and C4v and C5v If LongCondition then Result = 1 endif If ShortCondition then Result = -1 endif SCREENER[(LongCondition) Or (ShortCondition)] (Result as "Go")

cami1974
9 years ago
#

// Check this error on Vallourec UT1h for candle 13/11/2017 09:00 p1=9 p2=26 Tenkansen = (highest[p1](high)+lowest[p1](low))/2 Kijunsen = (highest[p2](high)+lowest[p2](low))/2 //C1 = Tenkansen > Kijunsen and Tenkansen[1] <= Kijunsen[1] C1 = Tenkansen crosses over Kijunsen IF C1 THEN DRAWARROWUP(barindex, low-atr) coloured(0, 155, 10) DRAWTEXT("TST+", barindex, low-atr*3, SansSerif, Bold, 30) coloured(0, 155, 10) ENDIF //C1v = Tenkansen = Kijunsen[1] C1v = Tenkansen crosses under Kijunsen IF C1v THEN DRAWARROWDOWN(barindex, high+atr) coloured(255, 0, 10) DRAWTEXT("TST-", barindex, high+atr*3, SansSerif, Bold, 30) coloured(255, 0, 10) ENDIF

cami1974
9 years ago
#

Hello, Thanks for this code. It seems that "crosses over" and "crosses under" functions have a bug when both variables are identical on previous period: crossing it's not detected. I've noticed this when testing Tenkan and Kijun crossing ("Tenkansen crosses over Kijunsen"): they can be identical for several periods. When replaced by double comparison ("Tenkansen > Kijunsen and Tenkansen[1] <= Kijunsen[1]") everything works fine. When using these functions with a constant ("Tenkansen crosses over 15"), everything works fine. I will post the code that I've used to test it in the next post. This is a known problem? Do I need to change all my code that uses these functions? Thanks in advance.

cami1974
9 years ago
#

Hello, Thanks for this code. It seems that "crosses over" and "crosses under" functions have a bug when both variables are identical on previous period: crossing it's not detected. I've noticed this when testing Tenkan and Kijun crossing ("Tenkansen crosses over Kijunsen"): they can be identical for several periods. When replaced by double comparison ("Tenkansen > Kijunsen and Tenkansen[1] Kijunsen and Tenkansen[1] <= Kijunsen[1] C1 = Tenkansen crosses over Kijunsen IF C1 THEN DRAWARROWUP(barindex, low-atr) coloured(0, 155, 10) DRAWTEXT("TST+", barindex, low-atr*3, SansSerif, Bold, 30) coloured(0, 155, 10) ENDIF //C1v = Tenkansen = Kijunsen[1] C1v = Tenkansen crosses under Kijunsen IF C1v THEN DRAWARROWDOWN(barindex, high+atr) coloured(255, 0, 10) DRAWTEXT("TST-", barindex, high+atr*3, SansSerif, Bold, 30) coloured(255, 0, 10) ENDIF This is a known problem? Do I need to change all my code that uses these functions? Thanks in advance.

elabuelomanyo
10 years ago
#

Hola buenas noches,

Con el codigo inicial y el acmbio propuesto por Doctrading si sale los cruces, pero no todos; solo aquellos en que se cumplen todas las condiciones.

Las condiciones C5 y C5v son muy restrictvas

//  Chikou > Kumo
// linea de precio retrasada 26 periodos por encima de la nube
// Chikou < Kumo
// linea de precio retrasads 26 periodos por debajo de la nube

Creo que hay que dar mas peso a la condicion de que el Tenkansen este por debajo o por encima del precio.

Un saludo

elabuelomanyo
10 years ago
#

Gracias por la aclaración Doctrading.

Con ese cambio, en el codigo inicial sigue saliendo una recta en cero.

Cuando  tenga todo el codigo mirado lo volvere a postear

Un saludo

Doctrading
10 years ago
#

The real formula is : 

Tenkansen = (highest[9](HIGH)+lowest[9](LOW))/2
Kijunsen = (highest[26](HIGH)+lowest[26](LOW))/2

But for me it works without "high" or "low"
We must write High and Low to be certain that it will work properly

elabuelomanyo
10 years ago
#

Hola buenas noches

Perdonen por escribir en español 

       Forgive me for writing in Spanish //

       Pardonnez-moi pour écrire en espagnol

El codigo y el fichero itf, no hacen lo que dice. en mi plataforma ProRealTime 10.2 las lineas 3 y 4 dan error hay que ponerles de que precio se hace el maximo y el minimo; las he sustituido por

Tenkansen = (highest[9](close)+lowest[9](close))/2
Kijunsen = (highest[26](close)+lowest[26](close))/2

Para que el codigo y el fichero haga algo se debe cambiar mas codigo.

 

////////////
//
// Codigos sacados de http://www.prorealcode.com/prorealtime-indicators
// http://www.prorealcode.com/library-list-view/
//
//   Ichimoku Tenkan-Kijun Cross
//   This code shows an Ichimoku indicator, for Tenkan-Kijun cross.
////////////

//  +1 for buy conditions
//  -1 for sell conditions

//  Buy conditions :
//  Tenkan crosses over Kijun
//  Tenkan & Kijun > Kumo
//  Close > Kumo
//  Chikou > Kumo


INDICATEUR = 0
cero = 0

Tenkansen = (highest[9](close)+lowest[9](close))/2
Kijunsen = (highest[26](close)+lowest[26](close))/2

SSpanA = (tenkansen[26]+kijunsen[26])/2
SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2

//Chikou = close[26]


// ACHAT
C1 = close > SSpanA and close > SSpanB
C2 = Tenkansen crosses over Kijunsen
C2ini = Tenkansen <= close
//C3 = Tenkansen > SSpanA and Tenkansen > SSpanB
//C4 = Kijunsen > SSpanA and Kijunsen > SSpanB
//C5 = Chikou > SSpanA[26] and Chikou > SSpanB[26]
if C2ini then
// cruce previo con el precio
INDICATEUR = INDICATEUR + .5
IF C2 or Tenkansen >= Kijunsen then
// cruces de medias 9, 26 o medias en tendencia
INDICATEUR = INDICATEUR + .5
if C1  then
// ademas por encima de la nube
INDICATEUR = INDICATEUR + .5
endif
endif
endif

//IF C1 and C2 and C3 and C4 and C5 THEN
//INDICATEUR = 1
//ENDIF

// VENTE
C1v = close < SSpanA and close < SSpanB
C2v = Tenkansen crosses under Kijunsen
C2vpre = Tenkansen >= close
//crosses over close
//C2vpreT = Tenkansen
//C2vprec = close[9]
//C3v = Tenkansen < SSpanA and Tenkansen < SSpanB
//C4v = Kijunsen < SSpanA and Kijunsen < SSpanB
//C5v = Chikou < SSpanA[26] and Chikou < SSpanB[26]
if C2vpre then
// previo con el precio
INDICATEUR = INDICATEUR - .5
endif
IF C2v  then
// cruces a laa baja
INDICATEUR = - .5
if C1v then
// ademas por debajo de la nube
INDICATEUR = INDICATEUR - .5
endif
endif
if C1  and INDICATEUR < 0 then
// ademas por encima de la nube
INDICATEUR = 0.2
endif

//IF C1v and C2v and C3v and C4v and C5v THEN
//INDICATEUR = -1
//ENDIF

return INDICATEUR as "ICHIMOKU TKC", cero as "cero"

Un saludo.

Nicolas
10 years ago
#

Gracias.

Nolamer
10 years ago
#

Bonjour, 

est ce possible de poster un programme Probacktest avec 

  • Achat si Tenkan croisement à la hausse la Kijun 
  • Vente si Tenkan croisement à la baisse la Kijun 

Cordialement 

Doctrading
11 years ago
#

A priori on ne peut pas ajouter d'image à un post.

On verra si par la suite ce forum nous le permet.
Cordialement,

supertiti
11 years ago
#

oui c'est cela si je veux ajouter une image je ne peux pas !

c'etait pour visualiser la chikou qui doit être reportée 26 jours en arrière dans le système Ichimoku

Doctrading
11 years ago
#

Bonjour,

Je n'ai pas bien compris la question, que veux-tu dire par "remonter" une image ?

Je ne crois pas qu'on puisse rajouter une image à un post effectivement.
Peut être que l'adminisstrateur lui le peut, avec un code HTML.

supertiti
11 years ago
#

comment remonte t'on une image ici ? je ne vois pas le bouton qui va bien ...merci

ProRealCode ProRealCode
Loading...