//p=4//////pp=15
calc=MoneyFlow[p](close)* Range[p]
///////////////////////////////////////////////
a=lowest[p](calc+low)
b=average[pp](a)
c=b/b[1]-1
d=highest[p](calc+high)
e=average[pp](d)
f=e/e[1]-1
return c*10000 coloured(255,0,0)as"bdmlowvol",f*10000 coloured(0,255,0)as "bdmhighvol",30as"su",-30as"giu"
///////////////////////////////////////////
///////commodity gilmore index
///////a=19 oppure 25
/////////b=18 oppure 28
////////////c=38 oppure 26
return (diplus[a]+diplus[b])-diplus[c]coloured(0,0,255)as"gilmorecorto",25COLOURED(255,0,0)as"25short",15COLOURED(0,255,0)as"15long",(diplus[a*2]+diplus[b*2])-diplus[c*2]coloured(0,0,100)as"gilmorelungo",20COLOURED(0,0,255)as"Centro"
///////////////////////////////////////////////
////stoc sestetto
///p=10
piuAlto = HIGHEST[p](HIGH)
piuBasso = LOWEST[p](LOW)
oscillatore = (CLOSE - piuBasso) / (piuAlto - piuBasso) * 100
RETURN oscillatore coloured(51,51,255)as"sestetto",45coloured(255,0,0)as" short",55coloured(0,255,0)as" long",10coloured(255,0,0)as"se ritesta buy",90coloured(0,255,0)as"se ritesta short",triangularaverage[round(p*0.618)](oscillatore)coloured(255,0,0)as"trigg"
///////////////////////////////////////
///////stocsestettoevolume
///p=10
piuAlto = HIGHEST[p](HIGH)
piuBasso = LOWEST[p](LOW)
oscillatore = (CLOSE - piuBasso) / (piuAlto - piuBasso) * 100
///////////////////////////////////////////
hilo= volume/range
opeclo= close-open
a= (exponentialaverage[2](hilo*opeclo))
piuAlto = HIGHEST[p](a)
piuBasso = LOWEST[p](a)
verde = (a- piuBasso) / (piuAlto - piuBasso) * 100
RETURN oscillatore COLOURED(51,50,250) as "sestettoblu",45coloured(255,0,0)as" 45short",55coloured(0,255,0)as"55 long",10coloured(255,0,0)as"10se ritesta buy",90coloured(0,255,0)as"90se ritesta short",verde COLOURED(0,102,0) as "verdesestettovolumeaggiungicolore"
///////////////////////////////////////
////stop volatilita
//////moltiplier=da2,5 a4
rang6= (highest[6]((high)[1]))-(lowest[6]((low)[1]))
rang7= ((rang6+range)/7)*moltiplier
stopshort=(lowest[7](close))+rang7
stoplong=(highest[7](close))-rang7
///////////////////////////////////////////////////////////
return ExponentialAverage[7](stopshort)coloured(255,0,0) as"stopshortsemplice",ExponentialAverage[7](stoplong)coloured(0,255,0) as"stoplongsemplice"
//////////////////////////////////
///////volume.system.force.index
return exponentialaverage[13](forceindex(close)),0
////////////////////////
/////////volume a moneyflow
a=MoneyFlow[p](close)*average[p](volume/range)
aa=MoneyFlow[pp](close)*average[pp](volume/range)
return a coloured(250,170,0)as "moneicorto",aa coloured(100,200,150) as"moneilungo",0 as"zero"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////volume.bost.rep.
/////////co=4
/////bostian
a=close+close-high-low
b=high-low
intens=a/b
bost=summation[co](intens)*volume
bostsu=0
if bost >0 then
bostsu=bost
else
bostsu=0
endif
bostgiu=0
if bost <0 then
bostgiu=bost
else
bostgiu=0
endif
lineabostsu=std [co*2] ( bostsu)
lineabostgiu=std [co*2] ( bostgiu)*-1
///////////////////////////////////////bostian///////////////
if bostsu>0 and bostsu>lineabostsu then
signal=2
endif
if bostsu>0 and bostsu
signal=1
endif
if bostgiu<0 and bostgiu
signal=-2
endif
if bostgiu<0 and bostgiu>lineabostgiu then
signal=-1
endif
////////////////////////////////////////////////////bostiansignal///////////////
///repulse/////////
rep=repulse[co](close)
repsu=0
if rep >0 then
repsu=rep
else
repsu=0
endif
repgiu=0
if rep <0 then
repgiu=rep
else
repgiu=0
endif
linearepsu=std [co*2] (repsu)
linearepgiu=std [co*2] ( repgiu)*-1
///////////////////////////////////////////////////////repulse repnal/////
if repsu>0 and bostsu>linearepsu then
repnal=2
endif
if repsu>0 and bostsu
repnal=1
endif
if repgiu<0 and bostgiu
repnal=-2
endif
if repgiu<0 and bostgiu>linearepgiu then
repnal=-1
endif
/////////////////////////////////repulse repnal
////volume a punti
hilo= volume/range
opeclo= close-open
a= (exponentialaverage[co](hilo*opeclo))
baseper=(signal+repnal)
///////////////////////
repulsignal=(exponentialaverage[co*2](repulse[co](close)))*2
if repulsignal>6 then
repulsignal=6
endif
if repulsignal<-6 then
repulsignal=-6
endif
return baseper COLOURED(51,0,0) as "lineamarrone.repulse.bostian",0.5COLOURED(0,255,0)as"limitsopra0",-0.5COLOURED(255,0,0)as"limitsotto0",repulsignal coloured(255,0,0)as"linearossa media doppia del repulse",0coloured(0,0,255)as"equilibrio",4coloured(51,0,0)as"4",-4coloured(51,0,0)as"-4"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////stop.trendlinea
c1=high>high[1]
c2=high>high[2]
c3=high>high[3]
c4=high>high[4]
var1=low
var2=low
var3=low
var4=low
if c1 and c2 and c3 and c4 then
trendlong=1
trendshort=0
endif
if var1 and var2 and var3 and var4 then
trendlong=0
trendshort=-1
endif
if trendshort=-1 then
if low
linea=low
else
linea=linea[1]
endif
endif
if trendlong=1 then
if high>linea then
linea=high
else
linea=linea[1]
endif
endif
return linea
//////////////////////////////////////////////////////////////////////////
///////////////Trend Index
////y=20
//ONCE y = 20 // This value is also the horizon of time over which the prediction is made. The larger y is, the larger the timeperiod over which we can interpret the indicatorIf there is a low trend index, there are too many reversals, or the price is stagnanting, so the price is not trendy.
Useful Applications :
High values of the trend index can be used to validate signals given by particular indicaters which are only valid in treding periods and not in trading ranges..
ONCE upTrend = 0
ONCE downTrend = 0
ONCE countHighs = 0
downTrendLength = 0
upTrendLength = 0
countUpTrends = 0 // Number of consecutive increasing bars
countDownTrends = 0 // Number of consecutive decreasing bars
countLows = 0
IF BarIndex > y+4 THEN
FOR x=0 TO y
IF Close[x]>Max(High[x+1],Min(High[x+2],Min(High[x+3],High[x+4]))) THEN
countHighs = countHighs + 1
upTrend = 1
ELSE
IF upTrend THEN
upTrendLength = countHighs + upTrendLength
countUpTrends = countUpTrends + 1
countHighs = 0
upTrend = 0
ENDIF
ENDIF
IF Close[x]
countLows = countLows + 1
downTrend = 1
ELSE
IF downTrend THEN
downTrendLength = countLows + downTrendLength
countDownTrends = countDownTrends + 1
countLows = 0
downTrend = 0
ENDIF
ENDIF
NEXT
upTrendAvgLength = upTrendLength/countUpTrends // Average length of bullish trends
downTrendAvgLength = downTrendLength/countDownTrends // Average length of bearish trends
trendsAvgLength = (upTrendAvgLength+downTrendAvgLength)/2 // Average length of trending periods.
trendingIndex = 1-(countDownTrends + countUpTrends)/y // Number of bullish and bearish trends. The less there are in relation to the number of bars, the more trendy the value is aand the higher TrendingBars will be.
ELSE
trendingIndex = undefined
trendsAvgLength = undefined
ENDIF
IF BarIndex > 2*y THEN
trendingIndexMMy = Average[y](trendingIndex)
ELSE
trendingIndexMMy = undefined
ENDIF
IF trendsAvgLength THEN
ENDIF
RETURN trendingIndex COLOURED(255,0,0) AS "Trending index", trendingIndexMMy COLOURED(255,128,0) AS "Trending index MA(y)" //, trendsAvgLength AS "Trends average length"
//////////////////////////////////////////////////
/////////TrailingStop
//////p=10
// ---- script begin ----
//
// TrailingStop%
// JWK, 20091016
perc = p // input Trailing Loss % - median term: 5 - 10
longloss = high*perc/100
shortloss = low*perc/100
If high < shorttrail[1] and direction[1] = -1 then // staying short
shorttrail = Min(shorttrail[1],low + shortloss)
longtrail = Min(longtrail[1],high - longloss)
plot = shorttrail
direction = -1
elsif high > shorttrail[1] and direction[1] = -1 then // short stopped out, going long
shorttrail = Max(shorttrail[1], low + shortloss)
longtrail = high - longloss
plot = longtrail
direction = 1
elsif low > longtrail[1] and direction[1] = 1 then // staying long
longtrail = Max(longtrail[1],high - longloss)
shorttrail = Max(shorttrail[1], low + shortloss)
plot = longtrail
direction = 1
elsif low < longtrail[1] and direction[1] = 1 then // long stopped out, going short
longtrail = Min(longtrail[1],high - longloss)
shorttrail = low + shortloss
plot = shorttrail
direction = -1
else
shorttrail = low + shortloss
longtrail = high - longloss
plot = longtrail
direction = 1
endif
return plot AS "TrailStop%"
// ---- script end ----////////////////////////////////////////
////////////volumi.pos.e.neg.
////m=5
volpos=0
volneg=0
for n=m downto 1
if close[n-1]=>open[n-1] then
volpos=volpos+volume[n-1]
elsif close[n-1]
volneg=volneg-volume[n-1]
endif
next
return volpos coloured(0,255,0) as "VOLUMI POSITIVI", volneg coloured(255,0,0) AS "VOLUMI NEGATIVI",0 as"zero",tema[m](volpos+volneg)as " trigger"
////////////volume per punticum
a=volume/range
b=abs(open-close)
indi= a*b
if open
volpi=indi*1
else
volpi=indi*-1
endif
return cumsum(volpi)
////////////////////////////////////////////////////////////////////////////////////
ciao serbuo
RispondiEliminacerco il cumulative volume delta per prorealtime.
ho provato a copiare questo ma mi dà errore alla riga 21.
puoi darmi una mano?
io di programmazione sò zero
grazie
buonissima giornata