Bonjour,
Je vous partage le code d’un indicateur trouvé ici meme, qui detecte automatiquement les “pin bar”
Cependant il les detecte toutes et j’aimerais un filtre à savoir, affiché le spin bar negative si : la bougie et rouge avec meche au dessus, positive si : bougie verte avec meche en dessous.
En gardant les memes conditions que ‘lindaciteur d’origine, merci de me venir en aide.
value = 0
clong1 = low < low[1] and low<low[2]
clong2 = close >= low[1]-1 and open >= low[1]-1
clong3 = abs(open - close) < 4*range/10
clong4 = open > (low + range*5/10) and close > (low + range*5/10)
cshort1 = high > high[1] and high > high[2]
cshort2 = close <= high[1]+1 and open <= high[1]+1
cshort3 = abs(open - close) < 4*range/10
cshort4 = open < (high - range*5/10) and close < (high - range*5/10)
if clong1 and clong2 and clong3 and clong4 then
value = 10
elsif cshort1 and cshort2 and cshort3 and cshort4 then
value = -10
endif
return value
Ps : désolé, je n’arrive pas le partager correctement ..
Comme ceci ? J’ai uniquement ajouté un test de la couleur de la bougie.
value = 0
clong1 = low < low[1] and low<low[2]
clong2 = close >= low[1]-1 and open >= low[1]-1
clong3 = abs(open - close) < 4*range/10
clong4 = open > (low + range*5/10) and close > (low + range*5/10)
cshort1 = high > high[1] and high > high[2]
cshort2 = close <= high[1]+1 and open <= high[1]+1
cshort3 = abs(open - close) < 4*range/10
cshort4 = open < (high - range*5/10) and close < (high - range*5/10)
if clong1 and clong2 and clong3 and clong4 and close>open then
value = 10
elsif cshort1 and cshort2 and cshort3 and cshort4 and close<open then
value = -10
endif
return value
C’est parfait Nicolas merci 😀
just a little
clong1 = low < low[1] and low<low[2]
clong2 = close >= low[1]-1 and open >= low[1]-1
clong3 = abs(open - close) < 4*range/10
clong4 = open > (low + range*5/10) and close > (low + range*5/10)
cshort1 = high > high[1] and high > high[2]
cshort2 = close <= high[1]+1 and open <= high[1]+1
cshort3 = abs(open - close) < 4*range/10
cshort4 = open < (high - range*5/10) and close < (high - range*5/10)
// graphics on Chart
rL = 255
gL = 0
bL = 0
rS = 0
gS = 0
bS = 255
PIP = 10*Pipsize ///ARROW DISTANCE
LIN = 3 //LENGTH OF SEGMENT OF SUPPORT OR RESISTENCE
RESISTENCE = 1*Pipsize //DISTANCE OF THE SEGMENT OF THE RESISTENCE
SUPPORT = 1*Pipsize
if clong1 and clong2 and clong3 and clong4 and close>open then
DRAWARROWDOWN(barindex,HIGH+PIP)coloured(rS,gS,bS)
DRAWSEGMENT(barindex,HIGH+RESISTENCE,barindex-LIN, HIGH+RESISTENCE) coloured(rS,gS,bS)
elsif cshort1 and cshort2 and cshort3 and cshort4 and close<open then
DRAWARROWUP(barindex,LOW-PIP)coloured(rL,gL,bL)
DRAWSEGMENT(barindex,LOW-SUPPORT,barindex-LIN, LOW-SUPPORT )coloured(rL,gL,bL)
endif
return
Très sympa ces codes…!
Cependant il y a une règle pour définir les Pin Bar, qui dit que (Open,Close) doivent être comprises dans le (High[1]-Low[1]).