I need to insert in this formula screen the comand to show just the cross if it happens in the day.
I ve a cross of SMA, or better a Sma with Composite Momementum, (I use this indicator), but I want see just it happens in the day.
My formula show all cross also of previous day.
thanks for the help Alessandro
// Il codice seguente si rivolge al timeframe daily
TIMEFRAME(daily)
ignored, ignored, ignored, ignored, ignored, indicator2 = CALL "Composite Momentum"
c2 = (indicator2)
c3=(indicator2)CROSSES OVER WeightedAverage[2]
SCREENER[c2 AND c3] (Variation AS "% Var barra prec")
Hi Alex,
I’m sorry but are you sure that your ‘Composite Momentum’ indicator is not crossing very often and on the last bar? Because a weighted average of 2 periods is very close to the price.
Also a weighted average is set on price value .. Does your composite momentum indicator too?
this is the CM formula.
Cioa Nicolas, no it doesn’t crossing often, the CM is a cyclical indicator. I use it just at end of day.
But I’d like have cross signal in my screen just the day that is realizing. whitout in the list the signal of previous days.
k=4
media1=WeightedAverage[k](Close)
media2=WeightedAverage[k*3](Close)
MOM=average[1](media1-media2)/(media1)*100
diffMOM=MOM-MOM[1]
If MOM>MOM[1] then
temp1=diffMOM
else
temp1=0
endif
If MOM<MOM[1] then
temp2=diffMOM
else
temp2=0
endif
sumtemp1=summation[5](temp1)
sumtemp2=summation[5](temp2)
abssumdiff=summation[5](abs(diffMOM))
aa=((sumtemp1[1]-(sumtemp1[1]/5)+temp1)/(abssumdiff[1]-(abssumdiff[1]/5)+abs(diffmom))*100)
bb=((sumtemp2[1]-(sumtemp2[1]/5)+temp2)/(abssumdiff[1]-(abssumdiff[1]/5)+abs(diffmom))*100)
cc=aa-abs(bb)
key=ExponentialAverage[3](cc)
k=((close-lowest[5](low))/(highest[5](high)-lowest[5](low)))*100
d=average[3](k)
xtl=WeightedAverage[3](d)*2-100
Composite=WeightedAverage[2]((2*key+xtl)/3)
l1=50
l2=-50
linea1=80
linea2=-80
linea3=0
return linea1,linea2,linea3,l1,l2,Composite
This indicator is an oscillator, right. But in your screener you are trying to test a cross of this indicator with a moving average weighted close of the price.. So that’s where is the mistake I believe.
I think you want your oscillator to cross its own value averaged. If yes, your screener code should look like this instead:
// Il codice seguente si rivolge al timeframe daily
TIMEFRAME(daily)
ignored, ignored, ignored, ignored, ignored, indicator2 = CALL "Composite Momentum"
c1 = indicator2 CROSSES OVER WeightedAverage[2](indicator2)
SCREENER[c1] (Variation AS "% Var barra prec")
Yes.. thanks. It was my mistake.