Bonsoir,
A partir d’un indicateur vu dans la bibliothèque, j’ai créé le mien afin de visualiser la position de certains indicateurs (STO, MACD,….) sous forme de petits symboles bleu ou rouge suivant le sens de l’indicateur.
// Paramètres stochastique HEIKIN ASHI
IsLastBarOnChart=currenttime=opentime and date=today
indicator1, indicator2, ignored, ignored = CALL "Stochastique Heikin-Ashi" [60, 6, 10]
if (indicator1 > indicator2) and (indicator1 < 80) then
DRAWTEXT("▲", BarIndex,4.0,SansSerif,BOLD,12) COLOURED(0,255,0)
elsif (indicator1 < indicator2) and (indicator1 > 20) then
DRAWTEXT("▼", BarIndex,4.0,SansSerif,BOLD,12) COLOURED(255,0,0)
ENDIF
if IsLastBarOnChart then
drawtext(" STO",barindex,4,dialog,bold,12)
endif
// Calcul RVI
once haopen = open
haclose = (open+close+high+low)/4
if barindex > 0 then
haopen = (haopen+haclose[1])/2
endif
m=30
p=60
upward = (haclose > haclose [1]) * STD[10]
downward = (haclose < haclose[1]) * STD[10]
upwardMA = wilderAverage[p](upward)
downwardMA = wilderAverage[p](downward)
RV = upwardMA / downwardMA
RVI = 100 - (100 / (1+RV))
upwardMA1 = wilderAverage[m](upward)
downwardMA1 = wilderAverage[m](downward)
RV1 = upwardMA1 / downwardMA1
Signal = 100 - (100 / (1+RV1))
c1a = (Signal > RVI) and (signal > signal[1]) and (RVI > RVI[1])
c1v = (Signal < RVI) and (signal < signal[1]) and (RVI < RVI[1])
if c1a then
DRAWTEXT ("▲", BarIndex,2.0, SansSerif,BOLD, 12) COLOURED (0,255, 0)
elsif c1v then
DRAWTEXT ("▼", BarIndex,2.0,SansSerif,BOLD,12) COLOURED(255,0,0)
ENDIF
if IsLastBarOnChart then
drawtext(" RVI",barindex,2,dialog,bold,12)
endif
/////////////////MACD IMPULSE ELDER////
// variables
// pc, fast ma, 12
// pl, slow ma, 26
// ps, signal, 9
// p, exp ma EIS, 18
// set first three as histograms
pc=12
pl=26
ps=9
REM MACD
hh=exponentialaverage[pc](close) - exponentialaverage[pl](close)
REM Signal
hh1=exponentialaverage[ps](hh)
IF hh > hh1 THEN
DRAWTEXT("▲", BarIndex,0.0,SansSerif,BOLD,12) COLOURED(32,0,192)
elsif hh < hh1 THEN
DRAWTEXT("▼", BarIndex,0.0,SansSerif,BOLD,12) COLOURED(255,0,0)
endif
if IsLastBarOnChart then
drawtext(" MACD",barindex,0,dialog,bold,12)
endif
// Paramètres du DMI
p=50
plusDM = (MAX(HIGH-HIGH[1], 0))*10
minusDM = (MAX(LOW[1]-LOW, 0))*10
IF plusDM > minusDM THEN
minusDM = 0
ENDIF
IF plusDM < minusDM THEN
plusDM = 0
ENDIF
IF plusDM = minusDM THEN
plusDM = 0
minusDM = 0
ENDIF
plusDI = WILDERAVERAGE[p](plusDM)
minusDI = WILDERAVERAGE[p](minusDM)
DM = plusDI-minusDI
moy = exponentialaverage[50](DM/pipsize)
if (moy > moy[1]) then
DRAWTEXT("▲", BarIndex,6.0,SansSerif,BOLD,12) COLOURED(32,0,192)
elsif (moy < moy[1]) then
DRAWTEXT("▼", BarIndex,6.0,SansSerif,BOLD,12) COLOURED(255,0,0)
endif
if IsLastBarOnChart then
drawtext(" DMI",barindex,6,dialog,bold,12)
endif
// Parameètres KAMA
indicator1 = CALL "KAMA 50"[50, 2, 30]
indicator2 = CALL "KAMA 200"[200, 2, 30]
c1 = ((indicator1 > indicator1[1]) and (indicator2 > indicator2[1]))
c2 = ((indicator1 < indicator1[1]) and (indicator2 < indicator2[1]))
if c1 then
DRAWTEXT("▲", BarIndex,8.0,SansSerif,BOLD,12) COLOURED(32,0,192)
elsif c2 then
DRAWTEXT("▼", BarIndex,8.0,SansSerif,BOLD,12) COLOURED(255,0,0)
endif
if IsLastBarOnChart then
drawtext(" KAMA",barindex,8,dialog,bold,12)
endif
Hi= 7.5
Lo=-1.0
return HI, Lo
mon problème est le suivant : j’ai ajouté un nouvel indicateur dont je voudrais ajouter le sens par l’ajout d’un symbole (pour être positionné, après barindex, j’ai mix le chiffre 10). Sauf que les symboles liés au sens de cet indicateur n’apparaissent pas (seul le nom de l’indicateur apparaît). J’aimerai savoir où est le problème. Merci.