Ciao buongiorno,
vorrei chiedere di creare un ProScreener per la ricerca di una figura costituita da 2 candele, sia in chiave ribassista sia rialzista.
La penultima candela deve essere una classica candela ribassista OPPURE rialzista costituita da un corpo non più di 1/3 della lunghezza totale della candela stessa.
La seconda candela, quindi l’ultima (quella attualmente “in vigore”) deve avere fatto un ritracciamento di almeno l’80% dell’intera lunghezza della penultima candela stessa.
Allego qualche esempio per farmi meglio capire.
Pronto a fornire ulteriori informazioni.
Grazie!
Saluti.
Andrea
Ciao,
ripensando a ciò che ho scritto nei 2 messaggi precedenti, mi sono accorto purtroppo di aver sbagliato ad esporre..e me ne scuso.
O meglio…in realtà il testo è giusto, ma ciò che ho sbagliato sono le immagini allegate, da cui si intende ERRONEAMENTE io stia cercando una figura con 2 candele similmente rialziste o ribassiste consecutive…invece no….io cerco, come scritto, una figura costituita da 2 candele: la penultima candela deve essere una classica candela ribassista OPPURE rialzista costituita da un corpo non più di 1/3 della lunghezza totale della candela stessa.
La seconda candela, quindi l’ultima (quella attualmente “in vigore”) deve avere invece un corpo di almeno (>=) l’80% dell’intera lunghezza della penultima candela stessa…e questo è l’unico “filtro”.
Allego qualche immagine (questa volta corretta 🙂 ) allo scopo di chiarire ciò io intenda.
Grazie ciao!
Andrea
JSParticipant
Senior
Ciao,
Prova questi…
pHigh = high[1]
pLow = low[1]
pOpen = open[1]
pClose = close[1]
pBody = abs(pClose - pOpen)
pRange = pHigh - pLow
// Ensure the body is not more than 1/3 of the total range
SmallBody = pBody <= (pRange / 3)
// Identify retracement of the last candle
cHigh = high
cLow = low
retracement = (cHigh - cLow) / pRange
// Ensure the last candle retraced at least 80% of the previous candle's range
Retraced = retracement >= 0.8
SCREENER[SmallBody AND Retraced]
Ciao,
ti ringrazio della veloce risposta.
Allora..
mi accorgo di essermi spiegato effettivamente non bene…per farti capire il mio errore, ho allegato le immagini ERRORE 1 e 2. In queste 2 immagini, l’ultima candela ha effettivamente un corpo >= all’80% della lunghezza della penultima candela (quella rialzista o ribassista) ma non è ciò che cerco…ciò che cerco, infatti, è che la seconda candela (l’ultima, la più recente del grafico) abbia IN COMUNE con la penultima una superficie corrispondente ALMENO all’80% della penultima candela stessa.
Puoi vedere ciò nell’immagine esempio allegata “Corretto 1.png”…come puoi vedere, in questo caso il tratto AB ricopre una distanza >= all’80% della lunghezza totale del corpo della penultima candela. Mi sono fatto capire, ora? effettivamente non mi ero espresso correttamente!
Molte grazie ciao!
JSParticipant
Senior
Se dividi l’attuale “cRange=High-Low” per il precedente “pRange=High[1]-Low[1]”, allora deve essere maggiore di 0,8 (80%)…
cRange/pRange>=0.8
È questo che vuoi?
Ciao, mi scuso per la mia incertezza ma, rileggendo, mi rendo conto di avere generato confusione e, inoltre, nel frattempo ho pensato ad una piccola modifica/semplificazione della regola stessa…dimenticandoci dei messaggi precedenti, ti chiedo ciò: 🙂
Il ProScreener dovrebbe filtrare i seguenti casi riguardanti le ultime 2 candele del grafico:
– PENULTIMA CANDELA:
- deve essere una classica candela ribassista OPPURE rialzista costituita da un corpo non più di 1/3 della lunghezza totale della candela stessa (e finora è uguale a sopra..).
- il corpo della candela deve, però, essere O nella parte superiore O nella parte inferiore della candela stessa (A PRESCINDERE LA CANDELA SIA RIALZISTA O RIBASSISTA) (non deve cioè toccare la metà / centro della candela (per evitare candele con il corpo al centro, di indecisione, ndr) (vd. file “candela da evitare.png”)
– ULTIMA CANDELA:
L’ultima candela dovrebbe invece avere le seguenti caratteristiche (vd. file “figura.png”):
- Nel CASO 1 (quindi penultima candela rialzista o ribassista, a prescindere…ma con il corpo nel terzo INFERIORE della candela stessa) deve avere il P di chiusura nel terzo SUPERIORE(più alto) della penultima candela.
- Nel CASO 2 (quindi penultima candela rialzista o ribassista, a prescindere…ma con il corpo nel terzo SUPERIORE della candela stessa) deve avere il P di chiusura nel terzo INFERIORE (più basso) della penultima candela.
Spero questa volta di essere stato più chiaro di prima.
Molte grazie!
Pronto a fornire eventuali ulteriori info.
Andrea
Come richiesto, ti condividiamo qui sotto sia l’indicatore che il ProScreener che identificano esattamente la configurazione descritta (corpo piccolo nella candela precedente + chiusura nella zona opposta nella candela attuale).
// Calculate body size and range of the previous candle
body1 = abs(close[1] - open[1]) // Size of the candle body
range1 = high[1] - low[1] // Full range (high - low)
thBody = range1 / 3 // Threshold: one third of the candle's height
// Check if the body is considered small (≤ 1/3 of range)
smallBody = body1 <= thBody
// Define body extremes
minbody1 = min(open[1], close[1]) // Bottom of the body
maxbody1 = max(open[1], close[1]) // Top of the body
// Define upper and lower thresholds to detect body location
LimitLow = low[1] + thBody // One-third from the bottom
LimitHigh = high[1] - thBody // One-third from the top
// Identify body location
// Body is at the top
if minbody1 >= LimitHigh then
BodyLocation = 1
// Body is at the bottom
elsif maxbody1 <= LimitLow then
BodyLocation = -1
// Body is in the middle (we exclude these)
else
BodyLocation = 0
endif
// Check for setup pattern
// Case 1: body at top and current close in upper third of previous candle
if smallBody and BodyLocation = 1 and close >= LimitHigh and close <= high[1] then
setup = 1
drawsegment(barindex[1], LimitHigh, barindex + 2, LimitHigh) style(dottedline)
drawsegment(barindex[1], LimitLow, barindex + 2, LimitLow) style(dottedline)
drawarrowup(barindex, low[1])
// Case 2: body at bottom and current close in lower third of previous candle
elsif smallBody and BodyLocation = -1 and close >= low[1] and close <= LimitLow then
setup = -1
drawsegment(barindex[1], LimitHigh, barindex + 2, LimitHigh) style(dottedline)
drawsegment(barindex[1], LimitLow, barindex + 2, LimitLow) style(dottedline)
drawarrowdown(barindex, high[1])
// If no valid pattern found
else
setup = 0
endif
return
// Calculate body size and range of the previous candle
body1 = abs(close[1] - open[1]) // Size of the candle body
range1 = high[1] - low[1] // Full range (high - low)
thBody = range1 / 3 // Threshold: one third of the candle's height
// Check if the body is considered small (≤ 1/3 of range)
smallBody = body1 <= thBody
// Define body extremes
minbody1 = min(open[1], close[1]) // Bottom of the body
maxbody1 = max(open[1], close[1]) // Top of the body
// Define upper and lower thresholds to detect body location
LimitLow = low[1] + thBody // One-third from the bottom
LimitHigh = high[1] - thBody // One-third from the top
// Identify body location
// Body is at the top
if minbody1 >= LimitHigh then
BodyLocation = 1
// Body is at the bottom
elsif maxbody1 <= LimitLow then
BodyLocation = -1
// Body is in the middle (we exclude these)
else
BodyLocation = 0
endif
// Check for setup pattern
// Case 1: body at top and current close in upper third of previous candle
if smallBody and BodyLocation = 1 and close >= LimitHigh and close <= high[1] then
setup = 1
// Case 2: body at bottom and current close in lower third of previous candle
elsif smallBody and BodyLocation = -1 and close >= low[1] and close <= LimitLow then
setup = -1
// If no valid pattern found
else
setup = 0
endif
screener[setup<>0](setup as "Setup")