Ciao ho provato a trasformare l’indicatore reversal point presente nel database in screener, ma quando provo a lanciarlo non mi segnala mai nessun titolo, ho fatto qualche errore nell’impostare lo screener?
ONCE SEGNALE = 0
sto = stochastic[8,3]
c1 = close[1]<open[1] and close>open
c2 = close>open[1]
c3 = lowest[3](low)<lowest[50](low)[1] or lowest[3](low)<lowest[50](low)[2] or lowest[3](low)<lowest[50](low)[3]
c4 = summation[3](sto<20)>0
long = c1 and c2 and c3 and c4
if long then
SEGNALE=1
ELSE
SEGNALE=0
endif
// SHORT
//Green/Red candle (reversal)
//Bearish candle close below the close of the previous green candle
//Space to the left (the high of the last 3 candles higher than the high of the last 50 candles)
//default stochastic (8,3,3) was in the overbought area within the last 3 candles.
c5 = close[1]>open[1] and close<open
c6 = close<open[1]
c7 = highest[3](high)>highest[50](high)[1] or highest[3](high)>highest[50](high)[2] or highest[3](high)>highest[50](high)[3]
c8 = summation[3](sto>80)>0
short = c5 and c6 and c7 and c8
if short then
SEGNALE=-1
ELSE
SEGNALE=0
endif
SCREENER [SEGNALE] (SEGNALE as "result")
Prova a togliere la riga 1, ONCE a volte da problemi a ProScreener.
Prova a togliere la riga 1, ONCE a volte da problemi a ProScreener.
Niente da fare, come si puo’ fare a scrivere allo screener se la condizione si è verificata nelle ultime tot barre per esempio?
Puoi chiarirmi quali sono le condizioni, capisco le righe 4-5 e 22-23, ma non capisco bene la 6 e la 24.
Intanto cerco di togliere le cose ridondanti, che tra l’altro rallentano l’esecuzione, alle righe 6 e 24, creo una riga in più ma è più leggibile
PiuBasso = lowest[3](low)
c3 = PiuBasso<lowest[50](low)[1] or PiuBasso<lowest[50](low)[2] or PiuBasso<lowest[50](low)[3]
PiuAlto = highest[3](high)
c7 = PiuAlto>highest[50](high)[1] or PiuAlto>highest[50](high)[2] or PiuAlto>highest[50](high)[3]
Capisco che per le condizioni C3 e C7 vai a ricercare il più basso/alto delle ultime 50 barre, ma perché indicare [1], [2] e [3] ?
Bene, aspettiamo la risposta.
@Nicolas, se la linea 10 dell’indicatore https://www.prorealcode.com/prorealtime-indicators/reversal-point-indicator/ significa
“//Space to the left (the lowEST of the last 3 candles lower than the low of the PREVIOUS last 50 candles)“
allora la riga 17 dovrebbe essere scritta così:
c3 = highest[3](low) < lowest[50](low[3])
e la riga 33:
c7 = lowest[3](high) > highest[50](high[3])
no?
Il risultato delle modifiche è nel grafico 2 della foto allegata.
Grazie.
Comunque Gianluca, il problema nel tuo codice è alle righe 10-14 e 28-32.
Togli le righe 10-14 e sostituisci le righe 28-32 con queste:
if long then
SEGNALE=1
elsif short then
SEGNALE=-1
ELSE
SEGNALE=0
endif
Quando Nicolas risponderà vedremo se l’indicatore va modificato o meno, ma non riguarda direttamente il tuo problema.
Confermo che il codice della riga condition3 (c3) è corretto come per il codice originale. Il minimo più basso degli ultimi 3 periodi è inferiore a quello dei 50 periodi.
Questa era la mia interpretazione (errata).
Ho provveduto a modificarlo @Roberto, grazie sempre per la tua disponibilita’ e grazie sempre anche a @Nicolas.
Ecco il codice, pero’ vedo che continua a non restituirmi mai alcun risultato:
ONCE SEGNALE = 0
sto = stochastic[8,3]
c1 = close[1]<open[1] and close>open
c2 = close>open[1]
c3 = lowest[3](low)<lowest[50](low)[1] or lowest[3](low)<lowest[50](low)[2] or lowest[3](low)<lowest[50](low)[3]
c4 = summation[3](sto<20)>0
long = c1 and c2 and c3 and c4
// SHORT
//Green/Red candle (reversal)
//Bearish candle close below the close of the previous green candle
//Space to the left (the high of the last 3 candles higher than the high of the last 50 candles)
//default stochastic (8,3,3) was in the overbought area within the last 3 candles.
c5 = close[1]>open[1] and close<open
c6 = close<open[1]
c7 = highest[3](high)>highest[50](high)[1] or highest[3](high)>highest[50](high)[2] or highest[3](high)>highest[50](high)[3]
c8 = summation[3](sto>80)>0
short = c5 and c6 and c7 and c8
if long then
SEGNALE=1
elsif short then
SEGNALE=-1
ELSE
SEGNALE=0
endif
SCREENER [SEGNALE] (SEGNALE as "result")
Prova a togliere (comnentandola) la riga 29 e sostituiscila con:
Return SEGNALE
in questo modo lo trasformi in indicatore, così lo metti sotto il grafico e vedi che segnali ti da, se te ne darà…. perché potrebbero anche non essercene o essercene pochi.