Buonasera a tutti,
avrei bisogno di un aiuto in merito a PROSCREENER. Mi piacerebbe realizzare una strategia con uno screener di questo tipo :
Long –> entry su
HAMMER < EMA21
STOCASTICO (14,3,3) IN IPERVENDUTO (< 20),
RSI IN DIVERGENZA RIALZISTA
Short –> entry su
SHOOTING STAR > EMA21,
STOCASTICO (14,3,3) IN IPERCOMPRATO (> 80),
RSI IN DIVERGENZA RIBASSISTA
Allego immagini per comprendere meglio le entrate e le uscite.
Grazie in anticipo.
Fausto
Servirà qualche giorno per farla, ma si può fare. 🙂
Grazie mille.
Il tempo che ti necessita.
Ho fatto finora dei backtest (non automatici ovviamente) e pare sia performante.
Ciao, Fausto
Prova questo screener e se va bene ti faccio la strategia:
// Ema 21
//
Ema21 = average[21,1](close)
//
// Stochastic 14,3,3)
//
p = 14
KL = 3
DL = 3
AvgT = 0 //average type (0=sma, 1=ema, 2= wma, ...)
K = average[KL,AvgT](((close - lowest[p](low)) / (highest[p](high) - lowest[p](low))) * 100)
D = average[DL,AvgT](K)
OB = 80 //Ipercomprato
OS = 100 - OB //Ipèervenduto
//
// Hammer & Shooting Star
//
body = close-open
abody = abs(body)
if range > 0 then
ratio = abody / range
else
ratio = 0
endif
bodytop = max(open, close)
bodybottom = min(open, close)
shadowtop = high-bodytop
shadowbottom = bodybottom-low
longcandle = (ratio > 0.6)
Hammer = (body[1]<0 and longcandle[1] and low<low[1] and shadowbottom>2*abody and shadowtop<0.3*abody)
ShootingStar = (body[1]>0 and longcandle[1] and high>high[1] and shadowtop>2*abody and shadowbottom<0.3*abody)
//
// Divergenze RSI
//
N = 40 //40 numero di barre entro le quali cercare una divergenza (20-60 è un range accettabile)
RsiP = 14 //14 periodi dell'RSI
miRSI = Rsi[RsiP](close)
Segnale = 0
IF (BarIndex > (N + RsiP + 1)) THEN
//
// Ribassista
//
IF (miRSI[1]>miRSI AND miRSI[1]>miRSI[2]) THEN
extremum2=miRSI[1]
extremum1=highest[N](miRSI)
preciomax2=close[1]
preciomax=Highest[N](close)
IF(extremum2<extremum1 AND preciomax2>preciomax[1]) THEN
for i=1 to N
if miRSI[i]=extremum1 then
Segnale=2
endif
next
endif
endif
//
// Rialzista
//
IF (miRSI[1]<miRSI AND miRSI[1]<miRSI[2]) THEN
extremum22=miRSI[1]
extremum11=lowest[N](miRSI)
preciomin2=close[1]
preciomin=lowest[N](close)
IF(extremum22>extremum11 AND preciomin2<preciomin[1]) THEN
for i2=1 to N
if miRSI[i2]=extremum11[1] then
Segnale=1
endif
next
ENDIF
ENDIF
endif
//
// LONG
L1 = Hammer
L2 = high < Ema21 //tutto lo HAMMER deve essere sotto la Ema21 (se basta la chiusura, usare CLOSE)
L3 = max(K,D) < OS
L4 = (Segnale = 1)
// SHORT
S1 = ShootingStar
S2 = low > Ema21 //tutto lo SHOOTING STAR deve essere sopra la Ema21 (se basta la chiusura, usare CLOSE)
S3 = min(K,D) > OB
S4 = (Segnale = 2)
//
CondL = L1 AND L2 AND L3 AND L4
CondS = S1 AND S2 AND S3 AND S4
Cond = 0
IF CondL THEN
Cond = 1
ELSIF CondS THEN
Cond = 2
ENDIF
//
SCREENER[Cond](Cond AS "1=↑, 2=↓")
io l’ho provato su TUTTI gli strumenti possibili (Forex, Indici, ITA+USA+UK, ecc…) e su molti TF, ma trova davvero pochi elementi. Devi fare un pò di prove per trovare i settaggi migliori. E’ effettivamente difficile che TUTTE le condizioni si verifichino sulla stessa candela.
Buongiorno Roberto.
Grazie tantissimo, effettivamente forse ci sono troppe variabili, anche a me ne tornano poche.
Provo a risettarla togliendo un parametro e ti faccio sapere.
Grazie molte.
A presto
Ho tolto la divergenza, compresso leggermente lo stocastico e usato il close al posto degli high e dei low per le pin.
Sul giornaliero ne restituisce 5 sulla generalità dei mkt.
Nei prossimi gg vedremo se funziona.
Grazie ancora Roberto.
Ciao