MaxParticipant
Average
Qui di seguito una domanda inviata a ProRealTime :
buongiorno
avrei bisogno di scrivere un trading sistem che operasse sulla base di questo indicatore UNIVERSAL.
vorrei che se il valore di questo indicatore e maggiore di 0, il sistema compri una posizione e se invece l’indicatore e minore di 0 venda 1 posizione, stop e target l’inserisco successivamente con stop loss e take profit
// Funzione : UNIVERSAL
//-------------------------------------------------------------------------
bandedge= 20
whitenoise= (Close - Close[2])/2
if barindex>bandedge then
// super smoother filter
a1= Exp(-1.414 * 3.14159 / bandedge)
b1= 2*a1 * Cos(1.414*180 /bandedge)
c2= b1
c3= -a1 * a1
c1= 1 - c2 - c3
filt= c1 * (whitenoise + whitenoise[1])/2 + c2*filt[1] + c3*filt[1]
filt1 = filt
if ABS(filt1)>pk[1] then
pk = ABS(filt1)
else
pk = 0.991 * pk[1]
endif
if pk=0 then
denom = -1
else
denom = pk
endif
if denom = -1 then
result = result[1]
else
result = filt1/pk
endif
endif
RETURN result COLOURED(66,66,255) as "Universal Oscillator", 0 as "0"
E un esempio di risposta :
// Funzione : UNIVERSAL
//-------------------------------------------------------------------------
bandedge= 20
whitenoise= (Close - Close[2])/2
if barindex>bandedge then
// super smoother filter
a1= Exp(-1.414 * 3.14159 / bandedge)
b1= 2*a1 * Cos(1.414*180 /bandedge)
c2= b1
c3= -a1 * a1
c1= 1 - c2 - c3
filt= c1 * (whitenoise + whitenoise[1])/2 + c2*filt[1] + c3*filt[1]
filt1 = filt
if ABS(filt1)>pk[1] then
pk = ABS(filt1)
else
pk = 0.991 * pk[1]
endif
if pk=0 then
denom = -1
else
denom = pk
endif
if denom = -1 then
result = result[1]
else
result = filt1/pk
endif
endif
c1= not longonmarket and result > 0
if c1 then
buy 1 share at market
endif
c2=not shortonmarket and result < 0
if c2 then
sellshort 1 share at market
endif