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 per il "TD SEQUENTIAL CONUTDOWN"
Attenzione alla funzione CALL che richiama il precedente listato, se si è modificato il nome modificare anche la funzione
Codice per il "TD COMBO VERSIONE 1"
Codice per il "TD COMBO VERSIONE 2"
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
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////////////////////////////////////////////
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:
///////////////////////////// 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:
///////////////////////////// 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: