Heiken Ashi TMS/TDI strategy
Je cherche à travailler cette stratégie et à confectionner l’indicateur correspondant (pour du manuel)
Indicateur = 1
Ctime = time >= 080000 and time <=200000
//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]
//SIGNAL D'ACHAT
ca1 = mab crosses over mbb
ca2 = mab<50
ca3 = xHigh>yellowMAshifted
IF ctime and ca1 and ca2 and ca3 THEN
drawarrowup(barindex,low-10*pointsize)coloured(0,255,0)
ENDIF
//Conditions de SORTIE ACHAT
csa1 = mab crosses under mbb
csa2 = mab<upperzone
csa3 = mab>50
csa4 = xlow>yellowMAshifted
IF csa1 and csa2 and csa3 and csa4 then
drawarrowdown(barindex,high+10*pointsize)coloured(0,0,0)
endif
//SIGNAL DE VENTE
cv1 = mab crosses under mbb
cv2 = mab>50
cv3 = xLow<yellowMAshifted
IF ctime and cv1 and cv2 and cv3 THEN
drawarrowdown(barindex,high+10*pointsize)coloured(255,0,0)
ENDIF
//Conditions de SORTIE VENTE
csv1 = mab crosses over mbb
csv2 = mab>lowerzone
csv3 = mab<50
csv4 = xhigh>yellowMAshifted
IF csv1 and csv2 and csv3 and csv4 then
drawarrowup(barindex,low-10*pointsize)coloured(0,0,255)
endif
RETURN indicateur
Comment faire pour qu’un SIGNAL D’ACHAT soit systématiquement suivi d’un signal de SORTIE D’ACHAT (et vice versa) ?
Par ailleurs, si certain d’entre vous utilise cette stratégie je serai content d’avoir vos retours : Comment vous l’utilisez ? Combien d’UT utilisez vous ? Lesquelles ? Personnellement je ne comprend pas la dernière condition d’achat (A quoi sert cette condition)
Merci de vos réponses
Quand tu rentres en position ACHAT, tu passes une variable à une valeur 1 par exemple. Tant que tu n’as pas reset cette valeur à 0, alors tu n’autorises uniquement que des sorties achat et vice-versa pour les ventes. C’est qu’une question d’autorisation ou non pour marquer les flèches.
Indicateur = 1
Ctime = time >= 080000 and time <=200000
//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]
//SIGNAL D'ACHAT
ca1 = mab crosses over mbb
ca2 = mab<50
ca3 = xHigh>yellowMAshifted
IF ctime and ca1 and ca2 and ca3 THEN
drawarrowup(barindex,low-10*pointsize)coloured(0,255,0)
X = 1
ENDIF
//Conditions de SORTIE ACHAT
csa1 = mab crosses under mbb
csa2 = mab<upperzone
csa3 = mab>50
csa4 = xlow>yellowMAshifted
IF X=1 and csa1 and csa2 and csa3 and csa4 then
drawarrowdown(barindex,high+10*pointsize)coloured(0,0,0)
endif
//SIGNAL DE VENTE
cv1 = mab crosses under mbb
cv2 = mab>50
cv3 = xLow<yellowMAshifted
IF ctime and cv1 and cv2 and cv3 THEN
drawarrowdown(barindex,high+10*pointsize)coloured(255,0,0)
Y = 1
ENDIF
//Conditions de SORTIE VENTE
csv1 = mab crosses over mbb
csv2 = mab>lowerzone
csv3 = mab<50
csv4 = xhigh>yellowMAshifted
IF csv1 and csv2 and csv3 and csv4 then
drawarrowup(barindex,low-10*pointsize)coloured(0,0,255)
endif
RETURN indicateur
Voici ce que j’ai fait mais cela ne fonctionne pas. Je ne comprends pas. Ou puis-je trouver mon erreur ?
"code" une question, un seul trade par jour ?
Création signal avec conditions qui peuvent ne pas se déclencher au même instant
Je suis désolé, j’ai bien lu les topics ci-dessus se rapportant à la question d’autorisation des signaux mais je ne comprends pas mon erreur (Il me semble avoir correctement reset les variables pourtant !)
= 0
Ctime = time >= 080000 and time <=200000
//indicateurs
MyRSI = rsi[13](close)
mab2 = average[2](MyRSI)
mbb7 = average[7](MyRSI)
yellowMA = average[5](TypicalPrice)
yellowMAshifted = yellowMA[2]
//Zone de surachat et survente
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
//SIGNAL D'ACHAT
ca1 = mab2 crosses over mbb7
ca2 = mab2<50
ca3 = xHigh>yellowMAshifted
IF (ctime and X=0) and ca1 and ca2 and ca3 THEN
X = 1
drawarrowup(barindex,low-10*pointsize)coloured(0,255,0)//VERT
ENDIF
//Conditions de SORTIE ACHAT
csa1 = mab2 crosses under mbb7
csa2 = mab2<upperzone
csa3 = mab2>50
csa4 = xlow>yellowMAshifted
IF X=1 and csa1 and csa2 and csa3 and csa4 then
X = 0//Reset
drawarrowdown(barindex,high+10*pointsize)coloured(0,0,255)//BLEU
endif
//SIGNAL DE VENTE
cv1 = mab2 crosses under mbb7
cv2 = mab2>50
cv3 = xLow<yellowMAshifted
IF (ctime and X=0) and cv1 and cv2 and cv3 THEN
X = 2
drawarrowdown(barindex,high+10*pointsize)coloured(255,0,0)//ROUGE
ENDIF
//Conditions de SORTIE VENTE
csv1 = mab2 crosses over mbb7
csv2 = mab2>lowerzone
csv3 = mab2<50
csv4 = xhigh>yellowMAshifted
IF X=2 and csv1 and csv2 and csv3 and csv4 then
X=0//Reset
drawarrowup(barindex,low-10*pointsize)coloured(0,0,0)//NOIR
endif
RETURN
Merci de votre aide
Il manque le X en 1ere ligne mais il s’agit d’une erreur de recopie… ce dernier est bien présent et cela ne fonctionne pas.
Il faut justement supprimer cette première ligne “x=0”, sinon à chaque clôture de bougie, on reset le fait qu’on est déjà dans un signal qui attend d’être fermé et ça met le bazar ! 🙂 Si tu enlèves cette ligne, tu verras que tout fonctionne correctement, une flèche blanche ferme une position de vente flèche rouge et une flèche bleue ferme une position d’achat flèche verte.
Je te remercie Nicolas ! Et j’en profite pour te dire que les vidéos de formations sont supers… c’est difficile de tout comprendre au premier passage mais c’est vraiment sympa Bravo !