Bonjour à tous,
Serait-il possible de mettre une valeur sur le dernier chandelier afin de pouvoir déclencher mes alertes
//PRC_CandlesticksStochastic | indicator
//25.10.2016
//Nicolas @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
period = 7
////////////////////////////////////////////////////////////////////
//lastest highhest high and lowest low over “period”
hh = highest[period](high)
ll = lowest[period](low)
scale = hh-ll
dynO = ((Open-ll)/scale)*100
dynH = ((High-ll)/scale)*100
dynL = ((Low-ll)/scale)*100
dynC = ((Close-ll)/scale)*100
//candle color
if Open>Close then
r = 0
g = 102
else
r = 102
g = 0
endif
//draw candlesticks
DRAWCANDLE(dynO,dynH,dynL,dynC) coloured(g,r,0) bordercolor (g,r,0)
return 0 as ” 0 ” ,23.6 as “23.6 % level”,38.2 as ” 38.2 “, 50 as “50% level”, 61.8 as ” 61.8 ” ,78.6 as “78.6% level”, 100 as ” 100 ”
// Variables :
// period = 26
J’ai ajouté la ligne 26 (mySignal = 0), où vous pouvez saisir la valeur ou l’expression de votre choix.
Les données ou le résultat seront renvoyés comme première valeur de la ligne 27 (RETURN) :
//PRC_CandlesticksStochastic | indicator
//25.10.2016
//Nicolas @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
period = 7
////////////////////////////////////////////////////////////////////
//lastest highhest high and lowest low over "period"
hh = highest[period](high)
ll = lowest[period](low)
scale = hh-ll
dynO = ((Open-ll)/scale)*100
dynH = ((High-ll)/scale)*100
dynL = ((Low-ll)/scale)*100
dynC = ((Close-ll)/scale)*100
//candle color
if Open>Close then
r = 0
g = 102
else
r = 102
g = 0
endif
//draw candlesticks
DRAWCANDLE(dynO,dynH,dynL,dynC) coloured(g,r,0) bordercolor (g,r,0)
mySignal = 0 //you can set any value of your choice here
return mySignal AS "Signal",0 as " 0 " ,23.6 as "23.6 % level",38.2 as " 38.2 ", 50 as "50% level", 61.8 as " 61.8 " ,78.6 as "78.6% level", 100 as " 100 "
// Variables :
// period = 26
merci Roberto, mais je n’ai pas de valeur qui s’affiche sur le dernier chandelier. J’aimerai pouvoir ajouter une ligne dynamique horizontale.
Voilà:
//PRC_CandlesticksStochastic | indicator
//25.10.2016
//Nicolas @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
DEFPARAM DrawOnLastBarOnly = True
period = 7
////////////////////////////////////////////////////////////////////
//lastest highhest high and lowest low over "period"
hh = highest[period](high)
ll = lowest[period](low)
scale = hh-ll
dynO = ((Open-ll)/scale)*100
dynH = ((High-ll)/scale)*100
dynL = ((Low-ll)/scale)*100
dynC = ((Close-ll)/scale)*100
//candle color
if Open>Close then
r = 0
g = 102
else
r = 102
g = 0
endif
//draw candlesticks
DRAWCANDLE(dynO,dynH,dynL,dynC) coloured(g,r,0) bordercolor (g,r,0)
mySignal = (abs(close - close[1])>= (range+range[1]))//0 //you can set any value of your choice here
IF mySignal <= 0 THEN
mySignal = mySignal[1]
ELSE
Offset = high
myBar = BarIndex
ENDIF
IF mySignal > 0 THEN
DrawSegment(myBar,Offset,BarIndex+20,Offset) style(line,2) coloured("Cyan")
ENDIF
return mySignal AS "Signal",0 as " 0 " ,23.6 as "23.6 % level",38.2 as " 38.2 ", 50 as "50% level", 61.8 as " 61.8 " ,78.6 as "78.6% level", 100 as " 100 "
À la ligne 26, vous devrez définir votre condition pour que le segment apparaisse sur le dernièr chandelier (celle où le signal s’est produit).
Si vous souhaitez qu’il commence sur le dernièr chandelier, remplacez la ligne 34 par ceci :
DrawSegment(barIndex,Offset,BarIndex+20,Offset) style(line,2) coloured("Cyan")