Programmazione Prorealtime Prorealtime:formule, indicatori, oscillatori, tsi ... (2 lettori)

tetsuo

Guest
TD SEQUENTIAL e TD COMBO setup e countdown

Insomma Black mi vuoi far lavorare anche la Domenica .......:zzz:




Codice per il "TD SEQUENTIAL SETUP"


Codice:
//////////////////////////////////////////////////////////////////////
 /////////////////////BUY SETUP////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 

 rem BUY SETUP
 

 rem azzero il conteggio dopo un segnale valido
 if buysetup[1]=1 then
     giornibuy=0
 endif
 

 

 rem condizione 1): controlla se la chiusura è inferiore alla chiusura di 4 giorni prima
 rem se vero inizia a contare
 if close<close[4]  then
     giornibuy=giornibuy+1
     
     rem condizione 2): se la conta è arivata a 8 o più controlla che il massimo
     rem sia maggiore o uguale minimo del terzo giorno prima o a uno qualsiasi degli ulteriori
     rem giorni precedenti se si manda il segnale
     if giornibuy>=8  then
         for n=3 to (giornibuy-1) do
             if high>low[n] and intersectionbuy[1]=0 then
                 intersectionbuy=1
                 break
             else
                 continue
             endif
         next
         
     else
         intersectionbuy=0
     endif
     
 else
     giornibuy=0
 endif
 

 rem se la conta è maggiore o uguale a 9 e se l'intersezione è presente e se il giorno precedente
 rem al primo giorno di setup presenta la condizione di price flip scatta il buy signal e si
 rem azzera la conta
 if giornibuy=>9 and intersectionbuy=1 and close[giornibuy]=>close[giornibuy+4] then
     buysignal=buysignal+1
 endif
 

 rem questa parte è scritta male ma svolge bene il suo lavoro
 if buysignal>buysignal[1] then
     buysetup=1
 else
     buysetup=0
 endif
 

 rem se scatta il setup trova il massimo assdoluto ed il minimo assoluto che si è avuto durante
 rem i giorni della conta che serve a definire il true range per il setup (Demark lo chiama TDSetupTrend)
 if buysetup=1 then
     mass=highest[giornibuy[1]+1](high)
     mini=lowest[giornibuy[1]+1](low)
     truerange=ABS(mass-mini)
 endif
 

 //////////////////////////////////////////////////////////////////////
 /////////////////////SELL SETUP///////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 

 rem SELL SETUP
 rem azzero il conteggio dopo un segnale valido
 if sellsetup[1]=1 then
     giornisell=0
 endif
 

 rem condizione 1): controlla se la chiusura è superiore alla chiusura di 4 giorni prima
 rem se vero inizia a contare
 if close>close[4]  then
     giornisell=giornisell+1
     
     rem condizione 2): se la conta è arrivata a 8 o più controlla che il minimo
     rem sia minore o uguale massimo del terzo giorno prima o a uno qualsiasi degli ulteriori
     rem giorni precedenti se si manda il segnale
     if giornisell>=8  then
         for n=3 to (giornisell-1) do
             if low<high[n] and intersectionsell[1]=0 then
                 intersectionsell=1
                 break
             else
                 continue
             endif
         next
         
     else
         intersectionsell=0
     endif
     
 else
     giornisell=0
 endif
 

 rem se la conta è maggiore o uguale a 9 e se l'intersezione è presente e se il giorno precedente
 rem al primo giorno di setup presenta la condizione di price flip scatta il sell signal e si
 rem azzera la conta
 if giornisell=>9 and intersectionsell=1 and close[giornisell]=<close[giornisell+4] then
     sellsignal=sellsignal+1
 endif
 

 rem questa parte è scritta male ma svolge bene il suo lavoro
 if sellsignal>sellsignal[1] then
     sellsetup=1
 else
     sellsetup=0
 endif
 rem se scatta il setup trova il massimo assoluto ed il minimo assoluto che si sono verificati durante
 rem i giorni della conta che serve a definire il true range per il setup (Demark lo chiama TDSetupTrend)
 if sellsetup=1 then
     mass=highest[giornisell[1]+1](high)
     mini=lowest[giornisell[1]+1](low)
     truerange=abs(mass-mini)
 endif
 

 return buysetup as "BUY SETUP", sellsetup as "SELL SETUP", mass as "TRUE HIGH", mini as "TRUE LOW" ,giornibuy as "GIORNIBUY", giornisell as "GIORNISELL", truerange as "TRUE RANGE"
 

 ////////////////////////////////////////////// FINE////////////////////////////////////////////
Codice per il "TD SEQUENTIAL CONUTDOWN"


Attenzione alla funzione CALL che richiama il precedente listato, se si è modificato il nome modificare anche la funzione
Codice:
 ///////////////////////////// INIZIO ///////////////////////////////////////////////////////
 

 rem Viene richiamata la funzione TD SEQUENTIAL e assegnate le variabili
 BUYSETUP, SELLSETUP, TRUEHIGH, TRUELOW, GIORNIBUY, GIORNISELL, ignored = CALL "TD SEQUENTIAL SETUP"
 

 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////  BUY SETUP  ////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

 rem Vengono definite le condizioni di interruzione della conta
 rem una chiusura maggiore al massimo relativo del setup e un segnale di BUYDAY
 if close>truehigh or buyday then
     flagbuy=0
     rem 9 giornate consecutive di setup in trend o controtrend
 elsif giornibuy>=9 or giornisell=>9 then
     flagbuy=0
 endif
 

 rem crea il segnale per il countdown
 if buysetup=1 then
     flagbuy=1
     countdownbuy=0
 endif
 

 

 rem il countdown aumenta per ogni chiusura inferiore al minimo di 2 giorni prima
 if flagbuy=1 then
     if close<=low[2] then
         countdownbuy=countdownbuy+1
     endif
     rem se si creano le condisioni di stop definite in precedenza torna a zero
 elsif flagbuy=0 then
     countdownbuy=0
 endif
 

 rem il buy day scatta se il countdown e arrivato a 13 e si verifica il price flip
 rem ovvero una chiusura maggiore del massimo di 2 giorni prima
 if countdownbuy[1]=>13 and close>high[2] and buyday=0 then
     buyday=1
 else
     buyday=0
 endif
 

 

 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////  SELL SETUP ////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

 rem Vengono definite le condizioni di interruzione della conta
 rem una chiusura minore al minimo relativo del setup e un segnale di SELL DAY
 if close<truelow or sellday then
     flagsell=0
     rem 9 giornate consecutive di setup in trend o controtrend
 elsif giornibuy>=9 or giornisell=>9 then
     flagsell=0
 endif
 

 rem crea il segnale per il countdown
 if sellsetup=1 then
     flagsell=1
     countdownsell=0
 endif
 

 

 rem il countdown aumenta per ogni chiusura maggiore al massimo di 2 giorni prima
 if flagsell=1 then
     if close>=high[2] then
         countdownsell=countdownsell+1
     endif
     rem se si creano le condisioni di stop definite in precedenza torna a zero
 elsif flagsell=0 then
     countdownsell=0
 endif
 

 rem il sell day scatta se il countdown e arrivato a 13 e si verifica il price flip
 rem ovvero una chiusura inferiore del minimo di 2 giorni prima
 if countdownsell[1]=>13 and close<low[2] and sellday=0 then
     sellday=1
 else
     sellday=0
 endif
 

 

 

 return countdownbuy as " BUY COUNTDOWN",  buyday as "BUY DAY",  countdownsell as "SELL COUNTDOWN",  sellday as "SELL DAY"
 

 ///////////////////////////////////// FINE //////////////////////////////////////////////////////////////
Codice per il "TD COMBO VERSIONE 1"
Codice:
 ///////////////////////////// INIZIO ///////////////////////////////////////////////////////
 

 //////////////////////////////////////////////////////////////////////
 /////////////////////BUY SETUP////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 

 if buysetup[1]=1 then
     giornibuy=0
 endif
 

 if close<close[4]  then
     giornibuy=giornibuy+1
 else
     giornibuy=0
 endif
 

 if giornibuy=>9  and close[giornibuy]=>close[giornibuy+4] then
     
     buysetup=1
 else
     buysetup=0
 endif
 

 

 //////////////////////////////////////////////////////////////////////
 /////////////////////SELL SETUP////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 

 if sellsetup[1]=1 then
     giornisell=0
 endif
 

 if close>close[4]  then
     giornisell=giornisell+1
 else
     giornisell=0
 endif
 if giornisell=>9  and close[giornisell]=<close[giornisell+4] then
     
     sellsetup=1
 else
     sellsetup=0
 endif
 

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  BUY COUNTDOWN ////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 if buysetup or sellsetup then
     countdownbuy=0
 endif
 

 if buysetup=1  then
     for n=(giornibuy-1) downto 0 do
         if countdownbuy=0 and (close[n]<=low[n+2] and low[n]<low[n+1] and close[n]<close[n+1]) then
             countdownbuy=1
             closeprevcountd=close[n]
         elsif countdownbuy=>1 and (close[n]<=low[n+2] and low[n]<low[n+1] and close[n]<closeprevcountd) then
             countdownbuy=countdownbuy+1
             closeprevcountd=close[n]
         endif
     next
 endif
 

 

 if buysetup=0 and countdownbuy=>1 and (close<=low[2] and low<low[1] and close<closeprevcountd) then
     countdownbuy=countdownbuy+1
     closeprevcountd=close
 endif
 

 if countdownbuy[1]=>13 and close=>high[2]  then
     buyday=1
     countdownbuy=0
 else
     buyday=-1
 endif
 

 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////  SELL COUNTDOWN  /////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

 if buysetup or sellsetup then
     countdownsell=0
 endif
 if sellsetup=1  then
     for n=(giornisell-1) downto 0 do
         if countdownsell=0 and (close[n]>=high[n+2] and high[n]>high[n+1] and close[n]>close[n+1]) then
             countdownsell=1
             closeprevcountd=close[n]
         elsif countdownsell=>1 and (close[n]>=high[n+2] and high[n]>high[n+1] and close[n]>closeprevcountd) then
             countdownsell=countdownsell+1
             closeprevcountd=close[n]
         endif
     next
 endif
 

 if sellsetup=0 and countdownsell=>1 and (close>=high[2] and high>high[1] and close>closeprevcountd) then
     countdownsell=countdownsell+1
     closeprevcountd=close
 endif
 

 if countdownsell[1]=>13 and close<=low[2]  then
     sellday=1
     countdownsell=0
 else
     sellday=-1
 endif
 

 

 return countdownbuy as "COUNTDOWNBUY", buyday as "BUYDAY", countdownsell as "COUNTDOWNSELL" , sellday as "SELLDAY"
 

 ///////////////////////////////////// FINE //////////////////////////////////////////////////////////////
Codice per il "TD COMBO VERSIONE 2"


Codice:
///////////////////////////// INIZIO //////////////////////////////
 //////////////////////////////////////////////////////////////////////
 /////////////////////BUY SETUP//////////////////////////
 //////////////////////////////////////////////////////////////////////
 

 if buysetup[1]=1 then
     giornibuy=0
 endif
 

 if close<close[4]  then
     giornibuy=giornibuy+1
 else
     giornibuy=0
 endif
 

 if giornibuy=>9  and close[giornibuy]=>close[giornibuy+4] then
     
     buysetup=1
 else
     buysetup=0
 endif
 

 //////////////////////////////////////////////////////////////////////
 /////////////////////SELL SETUP////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 if sellsetup[1]=1 then
     giornisell=0
 endif
 

 if close>close[4]  then
     giornisell=giornisell+1
 else
     giornisell=0
 endif
 

 if giornisell=>9  and close[giornisell]=<close[giornisell+4] then
     
     sellsetup=1
 else
     sellsetup=0
 endif
 

 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  BUY COUNTDOWN  //////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

 if buysetup or sellsetup then
     countdownbuy=0
 endif
 

 if buysetup=1  then
     for n=(giornibuy-1) downto 0 do
         if countdownbuy=0 and (close[n]<=low[n+2] and low[n]<low[n+1] and close[n]<close[n+1]) then
             countdownbuy=1
             closeprevcountd=close[n]
         elsif countdownbuy=>1 and (close[n]<=low[n+2] and low[n]<low[n+1] and close[n]<closeprevcountd) then
             countdownbuy=countdownbuy+1
             closeprevcountd=close[n]
         endif
     next
 endif
 

 

 if buysetup=0 and (countdownbuy=>1 and countdownbuy<10) and (close<=low[2] and low<low[1] and close<closeprevcountd) then
     countdownbuy=countdownbuy+1
     closeprevcountd=close
 elsif (countdownbuy=10 or countdownbuy=11 or countdownbuy=12) and close<close[1] then
     countdownbuy=countdownbuy+1
 endif
 

 if countdownbuy[1]=>13 and close=>high[2]  then
     buyday=1
     countdownbuy=0
 else
     buyday=-1
 endif
 

 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////  SELL COUNTDOWN  ///////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 

 if buysetup or sellsetup then
     countdownsell=0
 endif
 

 if sellsetup=1  then
     for n=(giornisell-1) downto 0 do
         if countdownsell=0 and (close[n]>=high[n+2] and high[n]>high[n+1] and close[n]>close[n+1]) then
             countdownsell=1
             closeprevcountd=close[n]
         elsif countdownsell=>1 and (close[n]>=high[n+2] and high[n]>high[n+1] and close[n]>closeprevcountd) then
             countdownsell=countdownsell+1
             closeprevcountd=close[n]
         endif
     next
 endif
 

 if sellsetup=0 and (countdownsell=>1 and countdownsell<10) and (close>=high[2] and high>high[1] and close>closeprevcountd) then
     countdownsell=countdownsell+1
     closeprevcountd=close
 elsif (countdownsell=10 or countdownsell=11 or countdownsell=12) and close>close[1] then
     countdownsell=countdownsell+1
 endif
 

 if countdownsell[1]=>13 and close<=low[2]  then
     sellday=1
     countdownsell=0
 else
     sellday=-1
 endif
 

 

 return countdownbuy as "COUNTDOWNBUY", buyday as "BUYDAY", countdownsell as "COUNTDOWNSELL" , sellday as "SELLDAY"
 

 ///////////////////////////////////// FINE //////////////////////////////////////////////////////////////

Aggiungo il link ad un post dove si può vedere come imposto graficamente gli indicatori

http://www.investireoggi.it/forum/showpost.php?p=889293&postcount=652


Ciao
 
Ultima modifica di un moderatore:

tetsuo

Guest
:nnoo:

Urca è sabato oggi ........allora lavoro lavoro lavaro fino alla febbre:-F


Presento allora uno screener:


  • tanto per tenermi in allenamento

  • per vedere se effettivamente proscreener ogni tanto fa cilecca,

  • ma soprattutto perchè ho visto che @ndy ne ha già postati 2 e quindi lo faccio anch'io :-o


Lo screener individua la rottura di una resistenza o di un supporto "recente"
Si basa, per l'individuazione dei livelli di S/R, su un pezzo di codice che ho scritto tempo fa con lo scopo di individuare i "TD POINT" .

In pratica su una finestra di 41 periodi il codice vede se al centro si è formato un max o un min, se lo trova, lo identifica come Resistenza o Supporto la rottura di tale livello accompagnata da un max sui volumi delle ultime 5 sedute fa scattare lo screener

Purtroppo non si possono settare variabili quindi la grandeza della finestra rimane fissa e se la si vuole cambiare bisogna agire sul codice


Codice:
centro=20
finestra=(20*2)+1
if high[centro]=highest[finestra](high) then
    segnale=1
elsif low[centro]=lowest[finestra](low) then
    segnale=-1
else
    segnale=0
endif

if segnale=1 then
    resistenza1=highest[finestra](high)
    
elsif segnale=-1 then
    supporto1=lowest[finestra](low)
    
endif

breackup=((close>resistenza1 and close[1]<resistenza1)) and (volume=>highest[5](volume))

breackdown= ((close<supporto1 and close[1]>supporto1)) and (volume=>highest[5](volume))

screener [breackup or breackdown]
Si possono creare aggiungendo poche righe anche varianti con più livelli di supporto e resistenza per esempio questa con tre supporti e tre resistenze in ordine di tempo
Codice:
centro=20
finestra=(20*2)+1
if high[centro]=highest[finestra](high) then
    segnale=1
elsif low[centro]=lowest[finestra](low) then
    segnale=-1
else
    segnale=0
endif

if segnale=1 then
    resistenza1=highest[finestra](high)
    resistenza2=resistenza1[1]
    resistenza3=resistenza2[1]
elsif segnale=-1 then
    supporto1=lowest[finestra](low)
    supporto2=supporto1[1]
    supporto3=supporto2[1]
endif

breackup=((close>resistenza1 and close[1]<resistenza1) or (close>resistenza2 and close[1]<resistenza2) or (close>resistenza3 and close[1]<resistenza3)) and (volume=>highest[5](volume))

breackdown= ((close<supporto1 and close[1]>supporto1) or (close<supporto2 and close[1]>supporto2) or (close<supporto3 and close[1]>supporto3)) and (volume=>highest[5](volume))

screener [breackup or breackdown]
Ciao
 
Ciao a tutti,
scusate la niubbaggine... ma il linguaggio per Prorealtime è il medesimo che si utilizza per Visual Trader? (Easy Language in entrambi i casi, ma uguali-uguali?)
Tanto per essere espliciti posso utilizzare su VT i medesimi listati che trovo qui per PRT?

Grazie a tutti.
 
Io utilizzo VT ma se mi spiegate pro e contro (costi!) potrei passare a PRT...
Sono obbrobriosoooooooo... ma... ve prego... aiutatemeeeeeee...
 

tetsuo

Guest
:eek::eek::eek::eek::eek::eek::eek:

NOOOOOO !!!!!

mughini direbbe......
che OBROBIOOOOOOO :D:D


ahhhhhhhhhhhhhhhhhh

noooooooooooooooooooooo


ABORRO MUGHINI





mughini11.jpg




:lol::lol::lol::lol:





Io utilizzo VT ma se mi spiegate pro e contro (costi!) potrei passare a PRT...
Sono obbrobriosoooooooo... ma... ve prego... aiutatemeeeeeee...


Ciao Bronza

in un 3d di PRT user mi parrebbe normale risponderti che è meglio quest'ultimo di Vt :D

Di sicuro quello dei due che sai usare già è meglio dell'altro, che prima di poterlo usare devi imparare a conoscerlo.

Della serie: chi lascia la strada vecchia per la nuova .................

Ciao
 

guz

Nuovo forumer
Da niubbo + niubbo ho visto che nella mia piattafgorma (igmarkets) è previsto un TS basato su prorealtime.
Mi piacerebbe sfruttarlo, ma avrei bisogno almeno di qualche listato per partire. In questo thread ne ho visti tanti, ma vorrei qualcosa da potere lanciare ed utilizzate per l'intraday o, ancora meglio, per il trading di breve periodo.
Ho visto che fortunatamente, prima di partire, c'è la possibilità di fare test su una porzione di dati, così almeno si riesce a verificare la remuneratività dell'algoritmo.
grazie a chiunque mi aiuterà a... partire
 

f4f

翠鸟科
Supertrend
L'indicatore supertrend di Oliver Seban (link)

Bisogna introdurre le varibabili aa (3) e bb (10). Tra parentesi i valori di default.

avola=averagetruerange[bb](close)
avg=medianprice
up=avg+aa*avola
dn=avg-aa*avola
once trend=1
if close>up[1] then
trend=1
elsif close<dn[1] then
trend=-1
endif
if trend<0 and trend[1]>0 then
flag=1
else
flag=0
endif
if trend>0 and trend[1]<0 then
flagh=1
else
flagh=0
endif
if trend>0 and dn<dn[1] then
dn=dn[1]
endif
if trend<0 and up>up[1] then
up=up[1]
endif
if flag=1 then
up=avg+aa*avola
endif
if flagh=1 then
dn=avg-aa*avola
endif
if trend=1 then
super=dn
else
super=up
endif
return super

:)
 

Users who are viewing this thread

Alto